Charter tags (tags.xml)


Tags can be used to mark content and/or pages for easy retrieval in other contexts, or to treat them differently. There are several types of tags, which are not used in the same way.

  1. Label types
    1. Applications
    2. Graphic charter
    3. Customized
  2. How do you define a label?
  3. How do I use a label?
    1. Page labels
    2. Content tags

 

Label types

Applications

These labels are supplied by the extension point org.ametys.web.tags.TagProviderExtensionPoint in the plugin.xml. They are generally used by services. For example, plugin Glossary provides a page tag to determine which page contains the glossary, so that each definition can be redirected to it.

Graphic charter

Graphic charter labels are mainly used to influence the charter by labeling a page or content. For example:

  • to make a page invisible in the menus or site map,
  • to build menus and submenus,
  • to select the pages to appear in the footer,
  • to assign a color variation to a page,
  • to highlight specific content,
  • not to display a content title,
  • etc ...

They are defined in a XML file called tags.xml is located in the cms/skins/[skinName]/conf/ folder.

Customized

Custom tags are defined by the contributor. In this way, they can classify content or pages according to their choice, and create content or page feeds based on this data. These labels are created using the Labels tool.

How do you define a label?

See the tags page .xml.

How do I use a label?

Page labels

Page labels can be used in filters, defined in cms/skins/[skinName]/templates/[templateName]/filters/default.xml. In this case, the returned data is already sorted according to the selected labels.

It is also possible to read page tags in the sitemap, for example, to create the menu. In this case, the SECTION label (label identifier) is searched for in the sitemap pages. These represent the menus. In the sitemap, all tags are prefixed by PLUGINS_TAGS_.

For example:

<ul>
<xsl:for-each select="/cms/sitemap//page[@PLUGIN_TAGS_SECTION]">
<li><a href="{$site-uri-prefix}/{$lang}/{@sitemap:path}.html"><xsl:value-of select="@sitemap:title"/></a></li>
</xsl:for-each>
</ul>

It's also possible to retrieve a tag from the current page without using the sitemap, via the page's tags. For example, you can hide the sub-menu of the current page as follows:

<xsl:if test="not(/cms/page/tags/NO_MENU)">
<!-- Création du sous-menu -->
</xsl:if>

Content tags

Content tags are retrieved each time content is generated, regardless of the view selected. Tags are found in the content's tags tag. To retrieve tagged content, proceed as follows:

<xsl:if test="not(tags/WITHOUT_TITLE)">
<h1><xsl:value-of select="title"/></h1>
</xsl:if>
Back to top