apostrophe
Version:
Apostrophe is a user-friendly content management system. You'll need more than this core module. See apostrophenow.org to get started.
40 lines (31 loc) • 1.09 kB
HTML
{# Outputs a simple link tag pointing to a page. #}
{# The title is correctly escaped. #}
{# If the page is unpublished, the unpublished class is added to the link. #}
{# If options.url is set, it is used instead of the page URL. #}
{# If options.void is set, javascript:void(0) is used as the URL. #}
{# If options.class is set, it is applied to the anchor element. #}
{# If options.span is set, a span is used instead of an anchor. This is #}
{# useful if you want the other features but don't want a link at all, as is #}
{# commonly the case for the current page. #}
{% macro pageLink(page, options = {}) %}
<{%- if options.span -%}
span
{%- else -%}
a href="
{%- if options.url -%}
{{ options.url | e }}
{%- elif options.void -%}
javascript:void(0)
{%- else -%}
{{ page.url | e }}
{%- endif -%}"
{% endif %}
class="apos-page-link {{ options.class }} {%- if not page.published -%}apos-unpublished{%- endif -%}"
>
{{ page.title | e }}
{%- if options.span -%}
</span>
{%- else -%}
</a>
{%- endif -%}
{% endmacro %}