Go to main content

Linklist

Contents

Syntax

<txp:linklist />

The linklist tag is a single or a container tag which is used to produce a list of links from the predefined list created on the Links panel.

If used as a container, it must be specified as an opening and closing pair of tags, like this:

<txp:linklist>
    …contained statements…
</txp:linklist>

Attributes

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

author="author name" v4.3.0+
Restrict to links with the specified author login name.
Default: unset.
auto_detect="string context" v4.3.0+
List of Textpattern contexts to consider when automatically searching for links. If you wish to turn off the automatic check, set this to auto_detect=".
Values: category (to look in the URL for a category list) and/or author (to look in the URL for an author list).
Default: category, author.
category="category name(s)"
Restrict to links from specified categories.
Values: (comma separated list of) category name(s). Note: category names may be different to the ‘Title’ you typed when you created the category, as the names are sanitized for URL use. Check the Categories panel to ensure you are using the correct names.
Default: unset.
form="form name"
Use specified form.
Default: plainlinks.
id="integer" v4.5.0+
Filter the links by this list of ids assigned at link creation time. The IDs can be found on the Links panel.
Default: unset.
limit="integer"
Number of links to display.
Default: 0 (no limit).
offset="integer"
The number of links to skip.
Default: 0.
pageby="integer or limit" v4.3.0+
Number of links to jump each page. Without this attribute, you cannot navigate using the newer and older tags. Usually you will want to track the limit attribute. Use pageby="limit" to do this, which means you will not have to amend two values if you subsequently decide to alter the limit.
Default: unset
realname="author real name" v4.3.0+
Restrict to links with the specified author name.
Default: unset.
sort="sort value(s)"
How to sort the resulting link list. Specify a value from the ones below, followed by a space and then add either asc or desc to sort in ascending or descending order, respectively.
Values:
category.
date.
description.
id (link id#).
linkname.
linksort.
rand() (random).
url.
Default: linksort asc.

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).
label="text"
Label prepended to item.
Default: unset (but see label cross-reference for exceptions).
labeltag="element"
HTML element to wrap (markup) label, specified without brackets (e.g. labeltag="h3").
Default: unset.
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

<txp:linklist form="Links" category="general" limit="10" sort="linksort" wraptag="p" />
<txp:if_category name="100">
    <txp:linklist label="First Floor" category="First" wraptag="ol" break="li" />
</txp:if_category>
<txp:if_category name="200">
    <txp:linklist label="Second Floor" category="Second" wraptag="ol" break="li" />
</txp:if_category>

This example uses the displayed page’s category as the criterion for choosing the linklist’s category.

Other tags used: if_category.

Example 3: Used as a container tag

<txp:linklist wraptag="ol" break="li">
    <txp:link /><br />
    <txp:link_description /><br />
    <txp:linkdesctitle />
</txp:linklist>

The tags within the container are repeated for each link provided by the linklist tag.

Other tags used: link, linkdesctitle, link_description.

Genealogy

Version 4.7.0

breakby attribute added.

Version 4.5.0

id attribute added.

Version 4.3.0

author and realname attributes added.
auto_detect attribute added to allow automatic (URL-based) contextual listings.
pageby attribute added to enable paging via newer and older tags.

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. :)