varia.website/themes/varia/templates/syndication.html

58 lines
3.0 KiB
HTML
Raw Normal View History

2017-07-06 14:28:42 +02:00
{#This template is for syndicating across the fucked up part of the web. It implements Open Graph and Twitter Card metadata to display links to HBSC well on social media
# This code is mostly taken from Talha Mansoor's Elegant pelican theme https://github.com/talha131/pelican-elegant
#}
{# Thumbnail image to show when homepage is shared on social media. It also
serves as the default image for posts whose featured_image is not set. #}
{% if not FEATURED_IMAGE %}
2018-02-26 21:57:38 +01:00
{% set FEATURED_IMAGE = 'https://varia.zone/images/de_varia.png' %}
2017-07-06 14:28:42 +02:00
{% else %}
{% set FEATURED_IMAGE = FEATURED_IMAGE %}
{% endif %}
{% macro syndication(article) %}
{% if article %}
<meta property="og:title" content="{{ article.title|striptags|e }} {%if article.subtitle %} - {{ article.subtitle|striptags|e }} {% endif %}"/>
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}" />
<meta property="og:description" content="{{article.description|striptags|e}}" />
<meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
<meta property="og:article:author" content="{{ article.author }}" />
{% if article.date %}
<meta property="og:article:published_time" content="{{ article.date.isoformat() }}" />
{% endif %}
{% if article.locale_modified and article.modified %}
<meta property="" content="{{ article.modified.isoformat() }}" />
{% endif %}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ article.title|striptags|e }} {%if article.subtitle %} - {{ article.subtitle|striptags|e }} {% endif %}">
<meta name="twitter:description" content="{{article.description|striptags|e}}">
{% if article.featured_image %}
2018-02-01 21:03:49 +01:00
<meta property="og:image" content="{{SITEURL}}{{article.featured_image}}" />
<meta property="og:image:secure_url" content="{{SITEURL}}{{article.featured_image}}" />
<meta name="twitter:image" content="{{SITEURL}}{{article.featured_image}}" >
2017-07-06 14:28:42 +02:00
{% else %}
{% if FEATURED_IMAGE %}
<meta property="og:image" content="{{FEATURED_IMAGE}}" />
<meta name="twitter:image" content="{{FEATURED_IMAGE}}" >
{% endif %}
{% endif %}
{% endif %}
{% if not article %}
<meta property="og:title" content="{{ SITENAME|striptags|e }}"/>
<meta name="twitter:title" content="{{ SITENAME|striptags|e }}">
<meta name="twitter:card" content="summary" />
<meta property="og:url" content="{{ SITEURL }}" />
<meta property="og:description" content="The Center of Everyday Technology is a Rotterdam based initiative that collects, conducts and instigates research into everyday technology.">
<meta property="twitter:description" content="The Center of Everyday Technology is a Rotterdam based initiative that collects, conducts and instigates research into everyday technology.">
2017-07-06 14:28:42 +02:00
<meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
<meta property="og:article:author" content="{{ AUTHOR }}" />
{% if FEATURED_IMAGE %}
<meta property="og:image" content="{{FEATURED_IMAGE}}" />
<meta name="twitter:image" content="{{FEATURED_IMAGE}}" >
{% endif %}
{% endif %}
{% endmacro %}