96 lines
3.6 KiB
Cheetah
96 lines
3.6 KiB
Cheetah
{# -*- coding: utf-8 -*- #}
|
|
|
|
{% macro meta_translations(post) %}
|
|
{% if translations|length > 1 %}
|
|
{% for langname in translations|sort %}
|
|
{% if langname != lang and ((not post.skip_untranslated) or post.is_translation_available(langname)) %}
|
|
<link rel="alternate" hreflang="{{ langname }}" href="{{ post.permalink(langname) }}">
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro html_tags(post) %}
|
|
{% if post.tags %}
|
|
<p itemprop="keywords" class="tags">
|
|
{% for tag in post.tags %}
|
|
{% if tag not in hidden_tags %}
|
|
<span class="tag"><a class="p-category" href="{{ _link('tag', tag) }}" rel="tag">{{ tag|e }}</a></span>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</p>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro html_pager(post) %}
|
|
{% if post.prev_post or post.next_post %}
|
|
<div class="pager hidden-print pagination">
|
|
|
|
<span class="previous pagination-item older">
|
|
{% if post.prev_post %}
|
|
<a href="{{ post.prev_post.permalink() }}" rel="prev" title="{{ post.prev_post.title()|e }}">
|
|
{% endif %}
|
|
{{ messages("Previous post") }}
|
|
{% if post.prev_post %}
|
|
</a>
|
|
{% endif %}
|
|
</span>
|
|
|
|
|
|
<span class="next pagination-item newer">
|
|
{% if post.next_post %}
|
|
<a href="{{ post.next_post.permalink() }}" rel="next" title="{{ post.next_post.title()|e }}">
|
|
{% endif %}{{ messages("Next post") }}
|
|
{% if post.next_post %}
|
|
</a>
|
|
{% endif %}
|
|
</span>
|
|
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro open_graph_metadata(post) %}
|
|
{% if use_open_graph %}
|
|
<meta property="og:site_name" content="{{ blog_title|e }}">
|
|
<meta property="og:title" content="{{ post.title()[:70]|e }}">
|
|
<meta property="og:url" content="{{ abs_link(permalink) }}">
|
|
{% if post.description() %}
|
|
<meta property="og:description" content="{{ post.description()[:200]|e }}">
|
|
{% else %}
|
|
<meta property="og:description" content="{{ post.text(strip_html=True)[:200]|e }}">
|
|
{% endif %}
|
|
{% if post.previewimage %}
|
|
<meta property="og:image" content="{{ url_replacer(permalink, post.previewimage, lang, 'absolute') }}">
|
|
{% endif %}
|
|
<meta property="og:type" content="article">
|
|
{# Will only work with Pintrest and breaks everywhere else who expect a [Facebook] URI. #}
|
|
{# %if post.author(): #}
|
|
{# <meta property="article:author" content="{{ post.author()|e }}"> #}
|
|
{# %endif #}
|
|
{% if post.date.isoformat() %}
|
|
<meta property="article:published_time" content="{{ post.formatted_date('webiso') }}">
|
|
{% endif %}
|
|
{% if post.tags %}
|
|
{% for tag in post.tags %}
|
|
<meta property="article:tag" content="{{ tag|e }}">
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro twitter_card_information(post) %}
|
|
{% if twitter_card and twitter_card['use_twitter_cards'] %}
|
|
<meta name="twitter:card" content="{{ twitter_card.get('card', 'summary')|e }}">
|
|
{% if 'site:id' in twitter_card %}
|
|
<meta name="twitter:site:id" content="{{ twitter_card['site:id'] }}">
|
|
{% elif 'site' in twitter_card %}
|
|
<meta name="twitter:site" content="{{ twitter_card['site'] }}">
|
|
{% endif %}
|
|
{% if 'creator:id' in twitter_card %}
|
|
<meta name="twitter:creator:id" content="{{ twitter_card['creator:id'] }}">
|
|
{% elif 'creator' in twitter_card %}
|
|
<meta name="twitter:creator" content="{{ twitter_card['creator'] }}">
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endmacro %}
|