Skip to content

Instantly share code, notes, and snippets.

@draganbabic
Created January 29, 2012 13:45
Show Gist options
  • Save draganbabic/1698896 to your computer and use it in GitHub Desktop.
Save draganbabic/1698896 to your computer and use it in GitHub Desktop.
Nice, custom page titles for Textpattern sites
<title>
<txp:hide>check to see if we're on the home page</txp:hide>
<txp:if_section name="">
<txp:hide>we are, display the site's name and slogan</txp:hide>
<txp:site_name /> — <txp:site_slogan />
<txp:else />
<txp:hide>we're not on the home page, check to see if we're in an article listing</txp:hide>
<txp:if_article_list>
<txp:hide>check to see if we are in a category listing</txp:hide>
<txp:if_category>
<txp:hide>we're in a category listing, display the category and section titles</txp:hide>
<txp:category title="1" /> — <txp:section title="1" />
<txp:else />
<txp:hide>we're in a regular section listing, display section title</txp:hide>
<txp:section title="1" />
</txp:if_category>
</txp:if_article_list>
<txp:hide>check to see if we're on an individual article page</txp:hide>
<txp:if_individual_article>
<txp:hide>we are on an individual article page</txp:hide>
<txp:title />
<txp:hide>check to see if the article is in a category</txp:hide>
<txp:if_article_category>
<txp:hide>it is, display category2 title (for you this may be category1)</txp:hide>
— <txp:category2 title="1" />
</txp:if_article_category>
<txp:hide>display article's section title</txp:hide>
— <txp:section title="1" />
</txp:if_individual_article>
<txp:hide>always display the site's name</txp:hide>
| <txp:site_name />
</txp:if_section>
</title>
@craigerskine
Copy link

How does this differ from the features in ob1_title?

@draganbabic
Copy link
Author

I honestly don't know as I only use plugins for features that TXP can't natively support (and I never used that plugin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment