Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
[howto] content based meta robot usage
Following the redesign of our sites a few months ago, we noticed that the search engines were listing content which was no longer populated. During the redesign we decided to go with sections and although categories are used, their pages are basically empty.
The code bellow – although it is scripted for our sites – can easily be adapted for anyone’s needs
<txp:if_search>
<meta name="robots" content="noindex,follow" />
<txp:else />
<txp:if_article_list><!-- article list page, either section or category -->
<txp:variable name="categoryname" value='<txp:page_url type="c" />' /> <!-- detect if you are in a category page -->
<txp:if_variable name="categoryname" value=""><!-- section home page -->
<txp:if_section name="sections,to,exclude,from,engines">
<meta name="robots" content="noindex,follow" />
<txp:else /><!-- remaining sections to include in search engines-->
<meta name="robots" content="index,follow,noodp,noydir" />
<meta name="keywords" content="your, keywords, here" />
<meta name="revisit-after" content="4 days" />
</txp:if_section>
<txp:else /><!-- category page -->
<txp:if_category name="categories,to,exclude,from,engines">
<meta name="robots" content="noindex,follow" />
<txp:else /><!-- remaining categories to include in search engines-->
<meta name="robots" content="index,follow,noodp,noydir" />
<meta name="keywords" content="your, keywords, here" />
</txp:if_category>
</txp:if_variable>
<txp:else /><!-- individual article page -->
<meta name="robots" content="index,follow,noodp,noydir" />
<meta name="revisit-after" content="20 days" />
<txp:meta_keywords />
</txp:if_article_list>
</txp:if_search>
Last edited by colak (2011-12-09 12:54:20)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [howto] content based meta robot usage
Nice, thanks for sharing. You might also want to consider <meta name="robots" content="index, follow, noodp, noydir">
in the above code.
A good description of what ‘noodp’ and ‘noydir’ actually do.
Offline
Re: [howto] content based meta robot usage
Thanks Phil,
I knew nothing about those. Added them above and in our sites.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Pages: 1