Go to main content

Keywords

Contents

<txp:keywords />

The keywords tag can be used as a single tag that Textpattern will replace with the keywords associated with the article being displayed. For keywords metadata, see meta_keywords tag.

Note: Textpattern 4.6.x warns this tag is deprecated and to use the meta_keywords tag instead. This is incorrect advice; the tag is reinstated as of Textpattern 4.7.0. Please ignore the warning.

Attributes

Common presentational attributes

These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.

break="value"
Where value is an HTML element, specified without brackets (e.g. break="li") or some string to separate list items.
Default: br (but see break cross-reference for exceptions).
breakby="integer" v4.7.0+
Used to group list items when separating by break. Possible values are lists of integers, like 2 (groups of 2 items) or 1,2 (alternate groups of 1 and 2 items).
Default: 1 (actually unset).
class="class name"
HTML class to apply to the wraptag attribute value.
Default: tag name or unset (see class cross-reference).
wraptag="element"
HTML element to wrap (markup) list block, specified without brackets (e.g. wraptag="ul").
Default: unset (but see wraptag cross-reference for exceptions).

Examples

Example 1: Show a list of keywords for an article, if they exist

<txp:if_keywords>
    <p>
        Keywords:
        <txp:keywords wraptag="ul" break="li" />,
    </p>
</txp:if_keywords>

Other tags used: if_keywords.

Genealogy

Version 4.7.0

break, breakby, class and wraptag attributes 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. :)