Textpattern CMS Template Tags

<txp:if_keywords /> container tag, 1 attributes

if_keywords

The if_keywords tag is a conditional tag and always used as an opening and closing pair, like this…

<txp:if_keywords>
...conditional statements...
</txp:if_keywords>

The tag will execute the contained statement if the current article’s keywords field has one or more entries.

attributes

keywords="unset" 
  • Comma-separated list of keywords.

genealogy

Version 4.0.7

  • tag added
<txp:if_keywords /> 1 examples

Supply meta tag if keywords exist

<head>
<txp:if_individual_article>
   <!— we are on a single article page —>
   <txp:if_keywords>
      <!— this single article has its own keywords —>
      <meta name=“keywords” content=”<txp:keywords />” />
   <txp:else />
      <!— this single article has no keywords: use some default keywords for meta data —>
      <meta name=“keywords” content=“apple, orange, pear, foo, bar” />
   </txp:if_keywords>
<txp:else />
   <!— we are on an article list page, use some default keywords for meta data —>
   <meta name=“keywords” content=“apple, orange, pear, foo, bar” />
</txp:if_individual_article>
</head>

Other tags used: keywords, if_individual_article, else