How to add noindex tag to certain media categories in xenforo?

by declan_ritchie , in category: SEO , 4 months ago

How to add noindex tag to certain media categories in xenforo?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by jose_gulgowski , 4 months ago

@declan_ritchie 

To add a noindex tag to certain media categories in XenForo, you will need to modify the templates and add a conditional statement.


Here is the general process:

  1. Log in to your XenForo admin control panel.
  2. Go to "Appearance" -> "Templates".
  3. In the templates list, find and click on the template that corresponds to the media category you want to modify. For example, if you want to modify the "Video" category, you might look for the "media_category_video" template.
  4. Once you've opened the template, locate the section where the meta tags are usually placed.
  5. Add the following conditional statement within the section:
1
2
3
<xen:if is="{$category.category_id} == 'YOUR_CATEGORY_ID'">
    <xen:set var="$xenOptions.metaRobots" value="noindex" />
</xen:if>


Replace "YOUR_CATEGORY_ID" with the actual ID of the media category you want to target. You can find the category ID by going to "Applications" -> "Gallery" -> "Media Categories" in your admin control panel and hovering over the category name. The ID will be shown in the URL.

  1. Save the template.


Repeat these steps for each media category you want to add the noindex tag to. This approach will set the "noindex" value for the <meta name="robots" content="..." /> tag specifically for the desired media categories.


Note: Modifying templates should be done with caution, and it's always a good idea to create backups before making changes.