Login  Register

Re: follow / no follow links

Posted by Pedro on Jun 26, 2012; 12:36am
URL: https://support.nabble.com/follow-no-follow-links-tp7580477p7580490.html

Harvey44 wrote
I believe that by default all links posted in Nabble forums are no follow (is this correct?)
Yes, they are "no follow" by default.
Harvey44 wrote
Is there a simple way for me to make specific links that I (alone) post do follow links?
We can make all links that an user group post to be "follow".
Edit "node_message_as_html" macro, adding the line 12. Here we are saving the author of the message:
<override_macro name="node_message_as_html" requires="node">
    <n.if.is_post>
        <then>
            <n.harvey_post_block.>
                <n.global_set_var name="harvey_post_author" value="[n.owner/]" />
                <n.regex_replace_all. pattern="[n.trim_regex/]" replacement="[n.lt/]br/[n.gt/]">
                    <n.node_message_block.message.message_as_html />
                </n.regex_replace_all.>
            </n.harvey_post_block.>
        </then>
        <else>
            <n.global_set_var name="harvey_post_author" value="[n.owner/]" /> 
            <n.node_message_block.message.message_as_html />
        </else>
    </n.if.is_post>
</override_macro> 
Create a user group called, for example, "follow" and add yourself, or the user that can post "follow" links, in this group.
Then, edit "process_message_html" macro. Here you have to check if the author of the message is not in the "follow" group, so we will add the "no follow" attribute in these cases:
<override_macro name="process_message_html" requires="html_list">
    <n.process_raw_tags/>
    <n.process_embed regex="[n.embed_regex/]" />
    <n.process_file_tags/>
    <n.apply_message_security/>
    <n.process_quotes wrote="[t][n.author/] wrote[/t]"/>
    <n.process_email/>
    <n.set_target_to_top/>
    <n.set_local_user.global_var name="harvey_post_author" />
    <n.if.not.local_user.is_in_group group="follow">
        <then.add_nofollow/>
    </n.if.not.local_user.is_in_group>    
    <n.process_smilies/>
</override_macro> 
My test forum.