1
0
mirror of https://github.com/avitex/avitex.github.io synced 2024-09-28 02:39:57 +00:00
1bit.pw/templates/macros.html

41 lines
1.2 KiB
HTML
Raw Normal View History

2018-08-22 13:30:07 +00:00
{% macro link(url) %}
{%- if url is starting_with("/") or url is starting_with("./") -%}
2020-04-14 02:23:38 +00:00
{{ get_url(path=url, trailing_slash=false) | safe }}
2018-08-22 13:30:07 +00:00
{%- else -%}
2020-04-14 02:23:38 +00:00
{{ url | safe }}
2018-08-22 13:30:07 +00:00
{%- endif -%}
{% endmacro link %}
{% macro is_active_nav(url, curr_url) %}
{%- if url == get_url(path="/") -%}
{{ url == curr_url }}
{%- else -%}
{{ curr_url is starting_with(url) }}
{%- endif -%}
2020-04-11 17:22:25 +00:00
{% endmacro is_active_nav %}
2020-04-14 02:23:38 +00:00
{% macro meta_desc(ctx) %}
2020-04-14 09:17:47 +00:00
{%- if ctx.description -%}
2020-04-14 02:23:38 +00:00
{{ ctx.description }}
{%- else -%}
{%- if ctx.summary -%}
{{ ctx.summary | striptags | replace(from="
", to=" ") | trim }}
{%- else -%}
{{ ctx.content | striptags | replace(from="
", to=" ") | trim }}
{%- endif -%}
{%- endif -%}
{% endmacro meta_desc %}
{% macro status_badge(status, desc, link, color) %}
{{ self::badge(type="badge", scope="status-" ~ status ~ "-" ~ color, desc=desc, link=link) }}
{% endmacro status_badge %}
{% macro badge(type, scope, desc, link) %}
{% if link %}
<a class="badge" href="{{ link }}"><img alt="{{ desc }}" src="https://img.shields.io/{{ type }}/{{ scope }}" /></a>
{% else %}
<img class="badge" alt="{{ desc }}" src="https://img.shields.io/{{ type }}/{{ scope }}" />
{% endif %}
{% endmacro link %}