Dofollow liên kết trong chữ ký thành viên cho XenForo

THB

Founder
Thành viên BQT
Tham gia
25/02/2015
Bài viết
6,650
Được Like
3,939
Trước khi vào bài viết mình xin nói qua về Dofollow và Nofollow. Dofollow & Nofollow là gì ? Tầm quan trọng của Dofollow và Nofollow?

Dofollow & Nofollow là gì ?
Đây là thuộc tính rel của thẻ liên kết <a>. Việc đặt thuộc tính nofollow trong rel của thẻ <a>, các webmaster đã nói cho các spider biết đừng đặt độ tin cậy lên các liên kết này và vì thế sẽ không có pagerank (không tính backlink) cho các đường dẫn với rel nofollow. Ngược lại với thuộc tính dofollow. Việc các liên kết có thuộc tính rel dofollow trỏ về Website của bạn sẽ ảnh hưởng tới PageRank.
Cú pháp:

HTML:
<a href="http://vnxf.vn" rel="nofollow"> (Nofollow ở liên kết)
<a href="http://vnxf.vn" rel="dofollow"> (Dofollow ở liên kết)

Tầm quan trọng của dofollow và nofollow
Khi bạn xây dựng backlink cho website của bạn như post bài quảng cáo trên các diễn đàn, tạo chữ kí, profile thì bạn nên để ý xem các liên kết này trỏ về website của bạn là dofollow hay nofollow. Vì chỉ dofollow mới tính backlink còn nofollow bạn chỉ nhận được direct traffic.


Ok, sau đây mình sẽ hướng dẫn các bạn cho phép dofollow các liên kết ở phần chữ ký của một nhóm thành viên nào đó. Mặc định, Xenforo sẽ để là dạng nofollow. Điều này sẽ tốt với các forum không muốn quan tâm đến liên kết bên ngoài của thành viên. Nhưng do nhu cầu SEO, cần cho phép dofollow các liên kết thì các bạn có thể làm như hướng dẫn bên dưới :

Bước 1: Tìm đến file /library/XenForo/ViewPublic/Helper/Message.php.

Bước 2: Thay đoạn code sau:

PHP:
$message[$options['signatureKey']], $parser, array('lightBox' => false)

Bằng đoạn code sau:

PHP:
$message[$options['signatureKey']], $parser, array('lightBox' => false, 'noFollowDefault' => false)

Bước 3: Đăng nhập vào Admin Control Panel và tạo một group mới với tên bất kì. Tiến hành đặt quyền hạn cho nhóm thành viên này có quyền chỉnh sửa phần chữ ký. Mặc định sau khi cài đặt XenForo thì nhóm Registered là nhóm mặc định cho tất cả các thành viên mới. Chính vì thế bạn hãy tắt chức năng chữ ký cho nhóm thành viên này.

chuky_permission-png.6


Bước 4: Tạo một nhóm thành viên mới dạng được ưu tiên (User group promotion) ở phần Admin Panel->Users->User Groups-> User Group Promotions. Sau đó hãy đặt một cái tên cho nhóm mới này. Ví dụ như nhóm ưu tiên chẳng hạn và tích vào mục Promotion is Active. Ở phần Add user to user groups, hãy chọn nhóm mà bạn vừa tạo với tên bất kì bên trên.

group-member-png.7


Ở đây chọn là nhóm Member.
Bước 5: Chuyển qua tab Apply This Promotion While. Chuyển xuống dưới đến phần Content and Achievements. Tích chọn vào mục User has posted at least X messages và nhập vào một số, đây chính là số bài viết mà user này phải đạt được để có thể chỉnh sửa chữ ký. Sau đó nhấn nút Save Promotion để lưu lại và kích hoạt nhóm ưu tiên.

content-and-achievement-png.8


Tới đây thì thành viên chưa đủ số bài viết theo như thiết lập bên trên sẽ không thể chỉnh sửa phần chữ ký. Những thành viên có số bài viết lớn hơn hoặc bằng thiết lập thì sẽ có chức năng chỉnh sửa chữ ký và được dofollow link trong phần chữ ký.
nguồn: vxf.vn​
 

THB

Founder
Thành viên BQT
Tham gia
25/02/2015
Bài viết
6,650
Được Like
3,939
hình như là có trong bài viết thôi. chữ ký mình chưa thử.
 

minmaxpro

Private
Tham gia
02/05/2017
Bài viết
19
Được Like
10
ad cho mình hỏi chút. Mình tìm đến file /library/XenForo/ViewPublic/Helper/Message.php nó có đoạn code như sau :
Mã:
<?php

class XenForo_ViewPublic_Helper_Message
{
    public static function getBbCodeWrapper(array &$message, XenForo_BbCode_Parser $parser, array $options = array())
    {
        $options = array_merge(array(
            'states' => array(),

            'contentType' => null,
            'contentIdKey' => null,

            'messageKey' => 'message',
            'messageParsedKey' => 'message_parsed',
            'messageCacheVersionKey' => 'message_cache_version',

            'showSignature' => true,
            'signatureKey' => 'signature',
            'signatureUserIdKey' => 'user_id',
            'signatureParsedKey' => 'signature_parsed',
            'signatureCacheVersionKey' => 'signature_cache_version',
            'signatureHtmlKey' => 'signatureHtml',

            'noFollow' => null
        ), $options);

        $text = $message[$options['messageKey']];

        if ($options['noFollow'] === null)
        {
            $options['noFollow'] = empty($message['isTrusted']) ? true : false;
        }

        $options['states'] += array(
            'noFollowDefault' => $options['noFollow']
        );

        if (empty($options['states']['attachments']) && !empty($message['attachments']))
        {
            $options['states']['attachments'] = $message['attachments'];

            if (stripos($text, '[/attach]') !== false)
            {
                if (preg_match_all('#\[attach(=[^\]]*)?\](?P<id>\d+)(\D.*)?\[/attach\]#iU', $text, $matches))
                {
                    foreach ($matches['id'] AS $attachId)
                    {
                        unset($message['attachments'][$attachId]);
                    }
                }
            }
        }

        if ($options['signatureKey'] && isset($message[$options['signatureKey']]))
        {
            if ($options['showSignature'])
            {
                if (array_key_exists($options['signatureParsedKey'], $message))
                {
                    $cache = array(
                        'contentType' => 'signature',
                        'contentId' => $options['signatureUserIdKey'] && !empty($message[$options['signatureUserIdKey']])
                            ? $message[$options['signatureUserIdKey']]
                            : null,
                        'cache' => !empty($message[$options['signatureParsedKey']])
                            ? $message[$options['signatureParsedKey']]
                            : null,
                        'cacheVersion' => !empty($message[$options['signatureCacheVersionKey']])
                            ? $message[$options['signatureCacheVersionKey']]
                            : null
                    );
                }
                else
                {
                    $cache = array();
                }

                // note: signatures are always nofollow'd by default
                $message[$options['signatureHtmlKey']] = new XenForo_BbCode_TextWrapper(
                    $message[$options['signatureKey']], $parser, array('lightBox' => false), $cache
                );
            }
            else
            {
                $message[$options['signatureHtmlKey']] = '';
            }
        }

        return new XenForo_BbCode_TextWrapper($text, $parser, $options['states'], array(
            'contentType' => $options['contentType'],
            'contentId' => $options['contentIdKey'] && !empty($message[$options['contentIdKey']])
                ? $message[$options['contentIdKey']]
                : null,
            'cache' => !empty($message[$options['messageParsedKey']])
                ? $message[$options['messageParsedKey']]
                : null,
            'cacheVersion' => !empty($message[$options['messageCacheVersionKey']])
                ? $message[$options['messageCacheVersionKey']]
                : null
        ));
    }

    public static function bbCodeWrapMessages(array &$messages, XenForo_BbCode_Parser $parser, array $options = array())
    {
        $options += array(
            'showSignature' => XenForo_Visitor::getInstance()->get('content_show_signature'),
            'states' => array()
        );

        foreach ($messages AS &$message)
        {
            $message['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($message, $parser, $options);
        }
    }
}
Hiện tại chữ ký tất cả thành viên đều cho dofollow, giờ mình muốn sửa lại nofollow thì làm sao? Mình đang xài xenforo 1.5.14. Thanks!
 
Người đăng Chủ đề tương tự Diễn đàn Trả lời Ngày đăng
THB Tutorial For SEOer 10
letuan4u Tutorial For SEOer 5

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mr. Tuấn

Mobile/Zalo: 0988 488 096

Telegram: bluekpro

Email: [email protected]

Nhà Tài Trợ

Mút Xốp Không Gian
pallet Thịnh Phát
Top Bottom