Highlighting an item in a list

The #EXPOSE tag is used to highlight, either in a menu or in a list, the main object of the page which the site visitor is currently viewing.

The object which is being "exposed" is the article (or news item, or section, or keyword, or author) which belongs to the current "context". In the case of sections, the breadcrumb hierarchy is generated, which makes it possible to "expose" the hierarchy of the sections that contain the article (or other object) being displayed.

By default, SPIP replaces the #EXPOSE tag with "on" if the object matches that of the context; otherwise the tag returns nothing at all.

However, the #EXPOSE tag can accept either one or two arguments, which allow you to specify what should be displayed for the exposed object, and what should be displayed for all the other objects. As an example, writing [(#EXPOSE{yes,no})] will display "yes" for the exposed object, and "no" for all of the others.

Displaying the exposed article differently

In its simple form, the #EXPOSE tag allows you to change the appearance of the link to the current article differently from other articles in a navigation menu. To modify the style of the links in such a menu, we could insert the #EXPOSE tag in the following manner into the article.html template:

with the following style instructions:

The object which is exposed in the list will then be highlighted by using different style commands

Disabling the exposed link

With a small change to the code, it is also possible to disable the link on the highlighted article as well as changing its appearance:

which will generate the following HTML code, where the <a> tags are replaced with <span> codes instead: