Search

Removing Thread Prefix Filter Link on Forum Pages

  • Thread starter EmeraldHike
  • Start date
EmeraldHike

EmeraldHike

Member
Joined
May 10, 2021
Messages
133
Reaction Score
0
Points
21
  • #1
One of the best features of XenForo forums is having the ability to filter thread results via "prefixes" on forum pages. As an administrator, you can set up a virtually unlimited number of prefixes (filters) on any forum page you wish. By default, those prefixes are clickable and when clicked, will filter out any threads that aren't tagged with the specific prefix. It's a really great feature and those who browse XenForo forums love them. It makes wading through thousands or millions of posts and threads much easier.

The problem is, these filters come at a cost. The first cost is that when a filter is clicked on, the results page creates a new URL. For example, if this is a regular forum page URL:

https://example.com/forum/forums/1/

This would be a filtered page URL:

https://example.com/forum/forums/1/?prefix_id=1

While the new URL does have a canonical link element on it, it's still duplicate content. Honestly, I don't think these new URLs would cause any problems, but with hundreds or thousands of prefixes, they could easily chew up a crawl budget. And before you ask (because of what I write below), Googlebot can find these filtered pages if they've got Adsense ads on them.

The second cost has to do with the fact that these prefixes are clickable and being so, are links. Each prefix link comes with a nofollow attribute, which tells search engine crawlers such as Google and Bing that the link shouldn't be followed. No pagerank is assigned to the new URL that's created by the filter. This is fine for the crawling aspect, but as far as pagerank distribution goes, it's not ideal in any sense of the word. For example, let's say you've got 20 thread links per forum page and each and every one of these thread links has a prefix link sitting right next to it. Instead of having only 20 links that get 5% of the page's pagerank assigned to each of them, you've now got 40 links; 20 good ones and 20 that are blocked by nofollow. Unfortunately, the way Google works these days is to simply toss the pagerank that would have been assigned to nofollow links right out the window. So instead of 100% of the pagerank flowing through the page's links, now only 50% will flow through. And what's worse is that the good links will only have 2.5% assigned to each one of them as opposed to the 5% they would have had, all because of a bunch of nofollow prefix links. That's not good.

What's the solution? I can only think of one. Well, maybe two. Don't use the prefix feature at all or use it, but remove the links that unregistered visitors would see. If you edit the THREAD_LIST_MACROS template page, you can make it so only logged in members can see and click the prefix links while those who aren't logged in can't. It'll be like those links don't even exist for the folks (and search engine crawlers) who aren't logged in. This is what I do on my own forums and it works well. I can create and apply as many prefixes as I want and not feel guilty for creating a whole lotta links.

Which code needs to be changed in the THREAD_LIST_MACROS template? Here it is down below in all its glory. Let me know if you have any trouble.



TEMPLATE: "THREAD_LIST_MACROS"
(remove prefix filter link for guests)
line 123

Code:
<!-- REMOVE PREFIX FILTER LINK FOR GUESTS -->
<xf:if is="$xf.visitor.user_id">
<a href="{{ link('forums', $forum, {'prefix_id': $thread.prefix_id}) }}" class="labelLink" rel="nofollow">{{ prefix('thread', $thread, 'html', '') }}</a>
<xf:else />
{{ prefix('thread', $thread, 'html', '') }}
</xf:if>
<!-- REMOVE PREFIX FILTER LINK FOR GUESTS -->
 
Top