Go to main content

Category1

Contents

Syntax

<txp:category1 />

The category1 tag can be used as either a single tag or container tag. It will display the category as defined by Category 1 in the article being displayed. When used as a container tag, it will turn the contents into a link to that category. Otherwise, it will return plain text.

This tag may be used within either an article form, or in a page, wrapped in an if_individual_article conditional tag.

Attributes

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

link="boolean"
Whether to link to articles from the same category. Works only in the single tag.
Values: 0 (no) or 1 (yes).
Default: 0.
section="section name" v4.0.4+
Restrict to articles from specified section(s).
Values: (comma separated list of) section name(s).
Default: unset, retrieves from all sections.
title="boolean"
Whether to output category title, rather than name.
Values: 0 (no, use name) or 1 (yes, use title).
Default: 0.
this_section="boolean" v4.0.4+
Whether to only link to articles from the section containing the current article.
Values: 0 (no, allow from any section) or 1 (yes).
Default: 0.

Examples

Example 1: Category name in plain text

<p>
    <txp:category1 />
</p>

Example 2: Hyperlinked category title

<p>
    <txp:category1 link title />
</p>

If category1 is defined with a title ‘Dogs’, this tag will display the words ‘Dogs’ as a hyperlink to a list of articles in the same category.

<txp:category1 wraptag="p">Other articles in category:
<txp:category1 title /></txp:category1>

Might display this HTML:

<p>
    <a rel="tag" href="https://example.com/category/dogs/">
        Other articles in category: Dogs
    </a>
<p>

Example 4: Category 1 and 2

<p>
    Filed in: <txp:category1 link title />
    <txp:if_article_category number="2">
        and <txp:category2 link title />
    </txp:if_article_category>
</p>

Shows a hyperlinked category 1, and also hyperlinked category 2 but only if it is used.

Other tags used: category2, if_article_category.

Genealogy

Version 4.0.4

class, section, this_section 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. :)