Go to main content

If keywords

Contents

Syntax

<txp: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 statement…
</txp:if_keywords>

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

Attributes

Tag will accept the following attributes (case-sensitive) as well as the global attributes :

keywords="keywords"
Comma-separated list of keywords.
Default: unset, which determines whether any keywords are assigned to the article.

Examples

Example 1: Supply meta tag if keywords exist

<head>
    ….
    <txp:if_individual_article>
        <txp:if_keywords>
            <txp:meta_keywords />
        <txp:else />
            <meta name="keywords" content="Apple, Orange, Pear, Foo, Bar" />
        </txp:if_keywords>

    <txp:else />
        <meta name="keywords" content="Apple, Orange, Pear, Foo, Bar" />
    </txp:if_individual_article>
    ….
</head>

Other tags used: meta_keywords, if_individual_article, else.

Genealogy

Version 4.0.7

Tag support added

If you notice any kind of problem with this page's construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)