Articles

articlesTop of Page

Iterator tags for articles.

Tag : <ion:articles />

Display articles from current page

<ion:page>

<!-- Articles iterator -->
<ion:articles>

<!-- Article -->
<ion:article>

<!-- Articles data -->
<ion:title tag="h4" />

<ion:date format="medium" tag="span" />

<!-- The first paragraph -->
<ion:content paragraph="1" />

</ion:article>
</ion:articles>
</ion:page>

Display articles from page named "news"

<ion:page id="news">

<ion:articles >

<ion:title tag="h3" />

<ion:content />

</ion:articles>

</ion:page>

Display articles from a given type

Each article can have an optional "type".

Types are linked to articles for a given page:
One article can have the type "side-box" on the home page and the same article can have no type in the page "news".

Types are defined in Content > Articles Types

To set the type of one article :

  • Edit the parent page
  • Set the wished type in the article list

<!-- Articles with type "bloc" or "small-bloc" -->
<ion:articles type="bloc,small-bloc">

<ion:article:title tag="h4" />

</ion:articles>

<!-- Articles with type "bloc" or no type -->
<ion:articles type="bloc,NULL">

<ion:article:title tag="h4" />

</ion:articles>

Tag attributes

All these <ion:articles /> tag attribute are optional.

AttributeDescription / ValuesVersionExample
all Returns article from all website, not only the parent page. From version 1.0.7
<ion:articles all="true">
  ...
</ion:articles>
type Type name.
Only returns articles from the given type.
Important : type="" will return the articles which doesn't have a type.

<ion:articles type="side-box">
...
</ion:articles>
limit Number of article to return.
Not compatible with use of pagination.

<ion:articles limit="3">
...
</ion:articles>
order_by "SQL order by" clause
Example : 'date DESC' will order the articles by date descending

<ion:articles order_by="date ASC">
...
</ion:articles>


filter Logical filtering of the articles on their base data.
Base data are : title, type, author

<ion:articles filter="author='admin'">
...
</ion:articles>
extend_filter

Filters articles on extend fields values.
Example: Get articles where one date extend is between a period.

When this attribute is used, the attribute order_by can also get the extend name as parameter

From version 1.0.9
<ion:articles extend_filter="date-event-begin .gt now();date-event-begin .lt date_add(now(), INTERVAL 7 DAY)">
  ...
</ion:articles>

<ion:articles order_by="date-event-begin ASC" extend_filter="date-event-begin .gt now();date-event-begin .lt date_add(now(), INTERVAL 7 DAY)">
  ...
</ion:articles>
range Get one range of articles.
(new from 1.0.0)

<ion:articles range="2,3">
...
</ion:articles>
content_type Get articles from given Content Type.
Tips : In association with the attribute "all", returns all articles from the given content type from the website.
From version 1.0.9
<ion:articles content_type="Blog">
  ...
</ion:articles>

Children tags

TagReturnsExample
<ion:count /> Number af articles in this collection
The number of articles in this page is :
<ion:page:articles:count />
<ion:article /> Article detail

articleTop of Page

Tag : <ion:article />

Can be used in 2 contexts :

  • Inside the <ion:articles /> parent tag.
    In this case, the tag is used to display data from the current looped article
  • Standalone, but only in one "Single Article" page view

Inside its parent tag

This is the common way to display article's data.

<ion:articles>

<ion:article:title />

<a href="<ion:article:url />">Read the complete article</a>

</ion:articles>

In one "Single Article" view

The "Single Article" view of one page is used to display one standalone article.

One good example of this behaviour is the blog :

In this case, the page called "blog" will have 2 views defined on the backend :

  • In Attributes > Views : The blog page view called "Blog"
  • In Attributes > Single Article View : The page article's detail view, called "Blog : One post"

In this case, both views are pages views, declared with the type "Page" in Settings > Themes

Example :

This code will display the current URL asked article in your "Single Article view" :

<!-- 
The URL called contains the article's URL : http://domain.tld/blog_page_url/blog_article_url
In this case, <ion:article /> will display the current asked article
-->
<ion:article>

<ion:title tag="h3" />

<ion:date format="d.m.Y" tag="span" class="post-date" />

<ion:content />

</ion:article>

Render each article with its own view

This method is not recommended any more, because it adds a lot of article views which can be confusing for the editor.
But in some cases, it can be useful.

To add and use articles dedicated views :

  • Set the articles usable views in Settings > Theme...
  • Edit one page and set the view to the wished article in the articles list
  • User the attribute render="true" so the <ion:article /> tag uses the defined view.

In your page view :

<ion:page:articles>

<ion:article render="true" />

</ion:page:articles>

Article children tagsTop of Page

These tags are <ion:article/> children tags.

TagReturnsExample
<ion:index /> the current index of the article in one article's list.
Start at 1.
<ion:articles>
<ion:article:index />
</ion:articles>

<!-- Display one "hr" each 3 articles -->
<ion:articles>
<ion:article:index expression="%3==0" >
<hr />
</ion:article:index>
</ion:articles>
<ion:date />

Returns the article's date :

  • Creation date or
  • Logical date if set in Ionize

See : Shared attributes : Date formatting attribute

<ion:articles>
<ion:article:date format="d.m.Y" />
</ion:articles>
<ion:content />

Returns the article's text content.

Attributes :

  • auto_link : Set to 'false', it disables the content anchors and email auto linking.

See : Shared attributes : String processing attributes

<ion:articles>
<ion:article:content auto_link="false" />
</ion:articles>
<ion:url />

Returns the URL to the article, in the context of it's main parent page.

<ion:articles>
<ion:article:url />
</ion:articles>
<ion:categories:list />

Displays the categories list to which this article is linked to.

Attributes :

  • link : Adds the link to each category if set to true
  • separator : HTML encoded separator char
<ion:articles>
<ion:article:categories:list link="true" separator=" / " />
</ion:articles>

<ion:article:writer />

Displays data about the article's last editor.

Attributes :

  • who : Key from the article to use as author, "author" by default.

See : Common data tags for all children of this tag.

<ion:article:writer who="updater">
<!-- Firstname & Lastname -->
<ion:firstname /> <ion:lastname />
...
</ion:article:writer>
<ion:article:next />

Returns the next article in the tree.
Children tags of this tag are the same than for the <ion:article /> tag.

From 1.0.6 :
all="true" return all next articles

<ion:article:next >
<ion:title tag="span" class="link" />
</ion:article:next>

From 1.0.6 :
<ion:article:next all="true">
<ion:title tag="span" class="link" />
</ion:article:next>

<ion:article:prev />

Same than <ion:article:next />, but returns the previous article.

From 1.0.6 :
all="true" return all previous articles

<ion:article:previous >
<ion:title tag="span" class="link" />
</ion:article:previous>
From 1.0.6 :
<ion:article:previous all="true">
<ion:title tag="span" class="link" />
</ion:article:previous>