How to Add XenForo Tag Links to Thread List?

CampFireJack

New Member
Joined
May 9, 2021
Messages
11
Reaction score
0
Points
1
  • #1
I use tags extensively on my XenForo forum and I would like to add tag links to the thread lists on forum pages. How can I set this up? Which templates do I need to edit? What code do I need to add? Thanks.
 

CaptainDan

New Member
Joined
May 9, 2021
Messages
11
Reaction score
0
Points
1
  • #2
On many XenForo forums, I've seen what you would like to do. It's a popular request. While I'm not sure how well tags do anymore as far as search engine optimization goes, they can surely help when it comes to helping visitors navigate your site. This is especially true on larger forums where locating information can be troublesome. With tags, all those threads can be categorized very nicely. It's such a shame that they're so frowned upon by the search engines these days. I used to own a few websites on which I used tags. They did nothing for me and actually drove down my search rankings from the moment I began using them, so be very careful how you go about adding them to your pages. They can spiral out of control easily.

Here's what they'll look like on your thread list (forum) pages:

xenforo-tags-thread-list.gif

Anyway, enough of my preaching. To answer your question, you'll need to edit the THREAD_LIST_MACROS template. You'll add the following code at line 183:

Code:
<xf:if is="$thread.tags">
<li>
<i class="fa fa-tags" aria-hidden="true" title="{{ phrase('tags')|for_attr }}"></i>
<span class="u-srOnly">{{ phrase('tags') }}</span>
<xf:foreach loop="$thread.tags" value="$tag">
<a href="{{ link('tags', $tag) }}" class="tagItem" dir="auto">{$tag.tag}</a>
</xf:foreach>
</li>
</xf:if>

A pared down version is below:

Code:
<xf:if is="$thread.tags">
<li>
<xf:foreach loop="$thread.tags" value="$tag">
<a href="{{ link('tags', $tag) }}" class="tagItem" dir="auto">{$tag.tag}</a>
</xf:foreach>
</li>
</xf:if>

The second option doesn't include the little tag icon before the tag list.

Let me know if this helps.
 
How to Add XenForo Tag Links to Thread List? was posted on 06-13-2021 by CampFireJack in the XenForo forum.

Similar threads

Forum statistics

Threads
88
Messages
156
Members
17
Latest member
mandy cromarty
Top