Textpattern Forum

You are not logged in. Register | Login | Help

#1 2011-12-09 08:31:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,970
Website

[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.org | neme-imca.org | hblack.net | LABS

Offline

#2 2011-12-09 11:33:13

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 1,599
Website

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

#3 2011-12-09 12:54:48

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,970
Website

Re: [howto] content based meta robot usage

Thanks Phil,

I knew nothing about those. Added them above and in our sites.


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

Board footer

Powered by FluxBB