{#
Reusable meta-tags macro for listing pages.
Renders the standard set of Open Graph and SEO ```` tags used on
pages that list posts (tag pages, category pages, archive pages, etc.).
Centralising the markup here means that a single edit to this file
changes the meta tags for every listing page at once.
Parameters:
title (str): The page title used in ``og:title`` and
``twitter:title``. The caller is responsible for constructing
a meaningful title (e.g. ``"Tag: python - My Blog"``).
Context variables used (passed via ``with context``):
site_description (str): Site description used for ``description``,
``og:description``, and ``twitter:description``.
site_keywords (list[str]): Keywords used for the ``keywords`` tag.
site_url (str): Base URL of the site, used for ``og:url`` and
constructing absolute image URLs.
site_title (str): Site name used for ``og:site_name``.
canonical_url (str): Canonical URL of the page used for ``og:url``.
has_platform_icons (bool): Whether platform icons have been
generated, used as the preferred source for ``og:image``.
site_logo (str): URL of the site logo, used as a fallback source
for ``og:image`` when no platform icons are present.
#}
{% macro listing_meta_tags(title) %}
{% if has_platform_icons %}
{% set og_image = site_url ~ '/icons/android-chrome-512x512.png' %}
{% elif site_logo %}
{% if site_logo.startswith('http://') or site_logo.startswith('https://') %}
{% set og_image = site_logo %}
{% elif site_logo.startswith('/') %}
{% set og_image = site_url ~ site_logo %}
{% else %}
{% set og_image = site_url ~ '/' ~ site_logo %}
{% endif %}
{% else %}
{% set og_image = '' %}
{% endif %}
{% if canonical_url %}
{% endif %}
{% if site_description %}
{% endif %}
{% if og_image %}
{% endif %}
{% if site_keywords %}
{% endif %}
{% if site_description %}
{% endif %}
{% if og_image %}
{% endif %}
{% endmacro %}