zola-inky-fork/templates/macros/opengraph.html
2023-02-01 17:58:59 +00:00

54 lines
1.9 KiB
HTML

{% macro og_preview() %}
<title>{{config.title}} | {{social::og_title() }}</title>
<meta
property="og:title"
content="{{config.title}} | {{social::og_title() }}"
/>
<meta property="og:type" content="website" />
<meta property="og:url" content="{{ current_url | safe }}" />
<meta property="og:description" content="{{ social::og_description() }}" />
<meta property="og:image" content="{{social::og_image() }}" />
<meta property="og:image:url" content="{{social::og_image() }}" />
<meta property="og:image:secure_url" content="{{social::og_image() }}" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="{{social::og_title() }}" />
<meta name="twitter:description" content="{{ social::og_description() }}" />
<meta property="twitter:image" content="{{social::og_image() }}" />
{% endmacro og_preview %}
{% macro og_description() %} {%- if section -%} {%- if
section.description -%} {{ section.description }} {%- else -%} {{
config.description }} {%- endif -%} {%- elif page -%} {%- if page.summary |
string -%} {{ page.summary | striptags | truncate(length=200) }} {%- elif
page.description -%} {{ page.description }} {%- else -%} {{ config.description
}} {%- endif -%} {%- endif -%}
{% endmacro og_description %}
{% macro og_title() %}
{%- if section -%}
{%- if section.title -%}
{{ section.title | striptags }}{%- else -%}
{{ config.description }}{%- endif -%}
{%- elif page -%}
{%- if page.title -%}
{{ page.title | striptags }}
{%- else -%}
{{ config.description }}
{%- endif -%}
{%- elif term -%}
{%- if term.name -%}
{{ term.name | striptags }}
{%- else -%}
{{ config.description }}
{%- endif -%}
{%- elif taxonomy -%}
{%- if taxonomy.name -%} {{ taxonomy.name | striptags }} {%- else -%} {{ config.description }} {%- endif -%} {%- endif -%}
{% endmacro og_title %}
{% macro og_image() %}
{%- if page.extra.og_preview_img -%}
{{ get_url(path=page.extra.og_preview_img) | safe }}
{%- endif -%}
{% endmacro og_image %}