When using the multiple {articles} you can also output at any point, just the data from a specific article, by using one of these prefixes before the desired data:

SyntaxDescription
this:... Any data from the article that is currently displayed, so the article that contains the plugin tag itself.
next:... Any data from the next article in the list of articles returned by the plugin tag.
previous:... Any data from the previous article in the list of articles returned by the plugin tag.
first:... J4 NEW Any data from the first article in the list of articles returned by the plugin tag.
last:... J4 NEW Any data from the last article in the list of articles returned by the plugin tag.
1:..., 2:..., 3:..., 4:..., etc. Any data from a specific article in the list of articles returned by the plugin tag. The data name must be prepended with the respective count number of the article.

After the prefix, you can then output any of Data Types, so including article data, category data, user data, and custom field values.

You can combine any prefix with any of the data types. Here are a few examples:

  • this:id will output the the ID of the current article that contains the plugin tag or is currently displayed
  • next:title will output the Title of the next article in the list
  • previous:alias will output the Alias of the previous article in the list
  • first:category:title will output the Category Title of the the first article in the list
  • last:author:name will output the Author Name of the the last article in the list
  • 2:title will output the Title of the second article in the list
  • You can output any other available article data or custom field (for example: this:speaker)

The count prefixes can be particularly useful, for example, if you want to display data from two (or more) articles side-by-side in a table:

{articles category="Fruit" limit="3"}{if is-first}

Name [1:title} [2:title} [3:title}
Alias [1:alias] [2:alias] [3:alias]
SEF Url [1:sefurl] [2:sefurl] [3:sefurl]
Image 1 [1:image-intro] [2:image-intro] [3:image-intro]

{/if}{/articles}

Name Strawberries Apples Bananas
Alias strawberries apples bananas
SEF Url /en/fruit/17-strawberries /en/fruit/12-apples /en/fruit/13-bananas
Image

Or if you would like to use data from the returned articles in a descriptive text, such as:

{articles category="Fruit" ordering="ordering ASC" limit="3"}{if is-first}
The best fruit ever is [1:title]. But [2:title] and [3:title] are pretty good too.
{/if}{/articles}

The best fruit ever is Strawberries. But Apples and Bananas are pretty good too.

These prefix can especially be useful in If Structures, for example to highlight the current active article in the list of articles returned by Articles Anywhere.

The following example checks whether the ID of one of the returned articles is the same as the currently displayed article. If it is, we put it in bold text, but we don't add a link to it. We only add a link to it to the other articles, not the one currently being displayed.

<ul>{articles category="My Category"}<li>
{if id = this:id}
	<strong>[title] (current)</strong>
{else}
	[link][title][/link]
{/if}
</li>{/articles}</ul>

The following example allows you to output a listing of articles grouped by category, with just one {articles} tag. We order articles by category, and then we only output a category header if the category of the current article is different from the previous one.

<ul>{articles ordering="category ASC, title ASC"}
{if category != previous:category}<h2>[category]</h2>{/if}
<li>[title]</li>
{/articles}</ul>

Animals

  • Cats
  • Dogs
  • Lions

Fruit

  • Apples
  • Bananas
  • Orange
  • Peach
  • Strawberries

Colors

  • Red
  • Green
  • Blue
  • Yellow