mirror of
https://github.com/jointakahe/takahe.git
synced 2024-12-01 19:51:00 +00:00
b53504fe64
Creates an OpenGraph template include in base.html including the basic tags expected on all pages. Then allows any page to add additional expected tags via `context`. Currently, profiles and posts are enriched to show complete opengraph metadata, and render correctly in Discord. Note: This does not show posts in Slack like Twitter/Mastodon do. I believe this is due to Slack preferring oembed when present, which is a mastodon API endpoint we may need to create at some point.
14 lines
593 B
HTML
14 lines
593 B
HTML
{% load opengraph %}
|
|
{% with opengraph_merged=opengraph_local|dict_merge:opengraph_defaults %}
|
|
<!-- Begin OpenGraph tagging -->
|
|
{% for key, value in opengraph_merged.items %}
|
|
<meta content="{{ value|striptags }}" property="{{ key }}"/>
|
|
{% if key == "og:description" %}
|
|
{# Mastodon duplicates this one tag without the og: prefix. Not sure why #}
|
|
<meta content="{{ value|striptags }}" property="description"/>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% block opengraph_extra %}
|
|
{% endblock %}
|
|
<!-- End OpenGraph tagging -->
|
|
{% endwith %}
|