You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _includes/atts-global.html
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,13 @@ <h3 id="common-global-attributes">Common global attributes</h3>
11
11
{% endunless %}
12
12
{% unless include.breakby == "" %}
13
13
<dt><code>breakby="integer(s)"</code></dt>
14
-
<dd>Used to group list items when separating by <code>break</code>. Possible values are lists of integers, like <code>2</code> (groups of 2 items) or <code>1,2</code> (alternate groups of 1 and 2 items).</dd>
14
+
<dd>Used to group list items when separating by <code>break</code>. Possible values are lists of integers, like <code>2</code> (groups of 2 items) or <code>1,2</code> (alternate groups of 1 and 2 items). Otherwise, the value is evaluated on each loop and `break` happens as soon as it changes. Note that `string` must be enclosed in *double* quotes.</dd>
15
15
<dd><strong>Default:</strong> {% if include.breakby == null %}1 (unset){% else %}{{ include.breakby }}{% endif %} (see <ahref="/tags/tag-attributes-cross-reference#breakby">breakby cross-reference</a>). </dd>
16
+
{% endunless %}
17
+
{% unless include.breakform == "" %}
18
+
<dt><code>breakform="form name"</code></dt>
19
+
<dd>A form to be used as `break`, generally jointly with `breakby` attribute. The special `<+>` pattern in this form will be replaced with the list "chunk" accumulated when break happens.</dd>
20
+
<dd><strong>Default:</strong> {% if include.breakform == null %}unset{% else %}{{ include.breakform }}{% endif %} (see <ahref="/tags/tag-attributes-cross-reference#breakform">breakform cross-reference</a>). </dd>
16
21
{% endunless %}
17
22
<dt><code>class="class name"</code></dt>
18
23
<dd>HTML <code>class</code> to apply to the wrapper.</dd>
Copy file name to clipboardExpand all lines: tags/article.md
+44-40Lines changed: 44 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ layout: document
3
3
category: Tags
4
4
published: true
5
5
title: Article
6
-
description: The basic article tag is used to output one or more articles depending on the attributes used.
6
+
description: The context-sensitive article tag is used to output one or more articles.
7
7
tags:
8
8
- Article tags
9
9
---
@@ -21,7 +21,7 @@ tags:
21
21
<txp:article />
22
22
~~~
23
23
24
-
The basic**article** tag can be used as either a *single* tag or *container* tag and used to output one or more articles depending on the attributes used. Default attributes will be used when nothing specific is assigned.
24
+
The powerful**article** tag can be used as either a *single* tag or *container* tag and used to output one or more articles depending on the context it is used and its attributes. Default attributes will be used when nothing specific is assigned.
25
25
26
26
It may be used as a *container* tag, in which case it must be specified as an opening and closing pair of tags, like this:
27
27
@@ -35,33 +35,28 @@ This is equivalent to putting the contained statements into a form named `my_for
35
35
36
36
The tag is context-sensitive, which means it will grab articles from the currently viewed section/category/author, etc.
37
37
38
-
When used on the front page, article's context will include articles from all sections set to display via 'Section appears on front page?' settings (see the Sections panel for more information).
38
+
When used on the front page, article's context will include articles from all sections set to display via 'Section appears on default page?' settings (see the Sections panel for more information).
39
39
40
-
Note: `<txp:article />` is **not** the same as `<txp:article_custom />` - you can [check out the differences of that tag](/tags/article_custom) if you're unsure of the differences!
40
+
Note: `<txp:article />` is **not** the same as `<txp:article_custom />` - you can [check out how that tag differs](/tags/article_custom) if you're unsure of the differences!
41
41
{: .alert-block .information}
42
42
43
43
## Attributes
44
44
45
-
Tag will accept content/behaviour and presentation attributes (**case-sensitive**) as well as the {% include atts-global-link.html %}:
45
+
The tag will accept the following content/behaviour and presentation attributes (**case-sensitive**) as well as the {% include atts-global-link.html %}:
46
46
47
47
`allowoverride="boolean"`
48
48
: Whether to use override forms for the generated article list.
49
49
: **Values:**`0` (no) or `1` (yes).
50
50
: **Default:**`1`.
51
51
52
-
`breakby="integer or string"` <spanclass="footnote warning">v4.7.2+</span>
53
-
: Used to group list items when separating by `break`. If its value is a list of integers, they will be used as groups size. For example, `2` (groups of 2 items) or `1,2` (alternate groups of 1 and 2 items).
54
-
: Otherwise, the value is evaluated on each loop and `break` happens as soon as it changes. Note that `string` must be enclosed in *double* quotes (see Example 7).
: A form to be used as `break`, generally jointly with `breakby` attribute. The special `<+>` pattern in this form will be replaced with the list "chunk" accumulated when break happens (see Example 7).
59
-
: **Default:** unset.
60
-
61
52
`customfieldname="value"`
62
53
: Restrict to articles with specified value for specified custom field name. Replace `customfieldname` with the actual name of the custom field.
63
54
: Important: Using dashes `-` or spaces may cause errors or render this feature ineffectual. Underscores in both custom field names and values are confirmed to work.
64
55
56
+
`exclude="article id(s) or field(s)"` <spanclass="footnote warning">v4.6.0+</span>
57
+
: Exclude a specific article or list of articles (each ID separated by a comma), or the articles with matching fields (author, category, etc.).
58
+
: **Default:** unset.
59
+
65
60
`form="form name"`
66
61
: Use specified form template to process each article.
67
62
: **Default:**`default`.
@@ -82,6 +77,16 @@ Tag will accept content/behaviour and presentation attributes (**case-sensitive*
82
77
: Use specified form when page is displaying an article list.
: Use comma-separated field(s) to match articles to the given URL parameters. Incoming variable names may be remapped by specifying the variable after an '=' sign. See Example 8.
82
+
: **Values:**\\
83
+
`category`. \\
84
+
`category1`. \\
85
+
`category2`. \\
86
+
`keywords`. \\
87
+
any custom field.
88
+
: **Default:** unset.
89
+
85
90
`offset="integer"`
86
91
: The number of articles to skip.
87
92
: **Default:**`0`.
@@ -143,33 +148,9 @@ Each field in the `textpattern` database table can be used as a sort key.
143
148
: **Values:**`past`, `future`, `any` (both `past` and `future`) or a [PHP-compatible date format](https://secure.php.net/manual/en/datetime.formats.php). In the latter case, `time` will be considered as the end date of the interval started by `month` or `expired` attribute.
144
149
: **Default:**`past`.
145
150
146
-
### Common presentational attributes
147
-
148
-
These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
: HTML element to wrap (markup) list block, specified without brackets (e.g. `wraptag="ul"`).
168
-
: **Default:** unset (but see [wraptag cross-reference](/tags/tag-attributes-cross-reference#wraptag) for exceptions).
169
-
170
151
### Note on 'article list' vs. 'individual article' context
171
152
172
-
The **article** tag is context-sensitive. It will produce different results depending on whether the page being viewed is an article list or an individual article. Article-list context includes the default (home) page, section front pages, and category pages. Individual-article context applies on an article page (i.e. a page with a URL like `https://example.com/archives/24/my-article`).
153
+
The **article** tag is context-sensitive. It will produce different results depending on whether the page being viewed is an article list or an individual article. Article-list context includes the default (home) page, section landing pages, and category pages. Individual-article context applies on an article page (i.e. a page with a URL like `https://example.com/archives/24/my-article`).
173
154
174
155
## Examples
175
156
@@ -292,15 +273,38 @@ In Textpattern [Page templates](/themes/page-templates-explained), add this tag
292
273
293
274
Other tags used: [section](/tags/section), [title](/tags/title).
294
275
276
+
### Example 8: Filter articles from the URL (v4.8.6+)
277
+
278
+
Adding `<input>` elements to your page in an HTML `<form>` allows you to search and filter articles by various parameters when the form is submitted. For example, you could send `?c=cat&keywords=some,keywords,list` to the URL and interpret it with this tag:
279
+
280
+
~~~html
281
+
<txp:articlematch="category, keywords" />
282
+
~~~
283
+
284
+
Or, if you need to fine-tune, you can remap the `key` URL parameter first by passing `?c=cat&key[]=some&key[]=keywords&key[]=list` and then interpreting it with:
0 commit comments