Posted By

jonhenshaw on 08/03/07


page content title system textpattern cms management

Versions (?)

Who likes this?

4 people have marked this snippet as a favorite


Reverse the Default Page Title Order in Textpattern

 / Published in: Textpattern

Textpattern's default page title markup -- txp:page_title -- always places the site name in front of the individual page name. This is irritating, because I prefer to have the interior content title come before the site title itself -- it just makes more sense that way and it's a lot more search engine friendly.

Use this code to replace txp:page_title on the page template to get the desired effect.

  1. <txp:if_section name="">
  2. <title><txp:site_name /></title>
  3. <txp:else />
  4. <txp:if_individual_article>
  5. <title><txp:title /> - <txp:site_name /></title>
  6. </txp:if_individual_article>
  7. </txp:if_section>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: jonhenshaw on February 3, 2008

The newest version of Textpattern has changed "sitename" to "site_name" – if you're using an older version of Textpattern, you'll probably want to use "sitename"

Posted By: adamlofting on July 31, 2008

Thanks - that's great.

Can this be shortened even further by moving the title tags outside?

Posted By: villagecreative on November 24, 2008

Yes, something like this should work:


Posted By: villagecreative on November 24, 2008

Whoops! Forgot to format the code, sorry.

Posted By: villagecreative on November 24, 2008
<title><txp:if_section name=""><txp:site_name /><txp:else /><txp:if_individual_article><txp:title /> - <txp:site_name /></txp:if_individual_article></txp:if_section>

You need to login to post a comment.