#URL_ARTICLE

The #URL_ARTICLE tag displays the URL of an article.

Using in a loop

Example : display of the list of articles in a section with a link to the article.

<BOUCLE_mon_article(ARTICLES){id_rubrique}>
<div class="bloc>
	<h3>#TITRE</h3>
	[<div class='texte'>(#TEXTE|couper{120, '...'})</div>
	<a href="#URL_ARTICLE">Read more…</a>
</div>
</BOUCLE_mon_article>

This tag is therefore used to generate links: <a href="#URL_ARTICLE"> ... </a> independently of the configuration choice made for the type of URLs for the site.
The HTML source returned could be in the form of:

  • spip.php?article146 (page)
  • Article_title.html (propres2)
  • article146.html (html)
  • ...

Any time that you change the URL mode, the tag will always generate the right kind of URL.

Out of loop use

Outside of an ARTICLES loop, it is possible to request the generation of the URL for a specific article by passing its ID as an argument to the tag:

#URL_ARTICLE{44}

will therefore displays the appropriate URL for the article with ID=44.

Relative or absolute URL?

By default #URL_ARTICLE returns the relative url, i.e. without the http://nom_domaine.ext/).

You can also get the absolute URL with the |url_absolue filter

[(#URL_ARTICLE|url_absolue)]

…will return http://www.mysite/Title_of_the_article.html

See also

Filters

Author Mark Published : Updated : 02/10/22

Translations : عربي, català, English, Español, français, Nederlands, русский, Türkçe, українська