Tag
Represents single tag associated with article. Tags for given article can be rendered by going through list of tags:
For editing in article:
{% if editmode %} {% editable article.tags %} {% else %} {% for tag in article.tags %} {{ tag.name }} {% endfor %} {% endif %}
By combining filters, there are shortcuts to render the list of tag names:
{{ article.tags | sort:"name" | map:"name" | join:", " }}For getting all site tags and generating tag clouds look at site object.
Attributes
name
Returns name of a tag.
path
Returns path of a tag for generating URLs.
Example of generating tag list next to article that links to blog page with articles filtered out with given tags:
{% for tag in article.tags %} <a href="/{{ article.page.path_with_lang }}/tagged/{{ tag.path }}">{{ tag.name }}</a> {% endfor %}
On Blog listing page
On blog listing page an object name tags is present and if blog listing page is displayed with tag filter this returns the filter of selected tags.
{% if tags %} {% if tags == empty %} {{ "no_posts_tagged" | lc }} {% else %} {{ "posts_tagged" | lc }} '{{ tags | sort:"name" | map:"name" | join:"', '"}}'. {% endif %} {% endif %}
- Basics
- Variables
- Filters
- Components
- Localization
- Keyboard shortcuts
- Objects
- Article
- Asset
- Blog
- Comment
- Element
- Language
- Mediaset
- Menu item
- Page
- Person
- Site
- Tag
- Data
- Tags
- addbutton
- assign
- blogcontext
- case
- capture
- commentform
- content
- contentblock
- cycle
- editable
- elementscontext
- for
- grouped
- if
- ifchanged
- image
- include
- load
- login
- loginblock
- menuadd
- menubtn
- menulink
- reorder
- rss_link
- stylesheet_link
- unless
- xcontent
- Examples
- Creating a navigation menu
- Creating language selection
- Blog page example
- Blog article example
- Complete page example
- Breadcrumbs
- Standard theme definition
- Elements listing
- Element page
- Components