Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fediverse:creator meta support #2075

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/4-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,10 @@ This template adds the following meta tags:
- Pagination links (first, previous, next, last)
- Canonical URL
- Links to alternate versions (i.e.: RSS feed, others languages)
- `rel=me` support
- Open Graph
- Twitter Card
- Mastodon meta
- Structured data (JSON-LD)

#### metatags options and front matter
Expand All @@ -331,11 +333,16 @@ social:
twitter:
site: username
creator: username
url: URL
mastodon:
creator: handle
url: URL
facebook:
id: 123456789
firstname: Firstname
lastname: Lastname
username: username
url: URL
```

:::tip
Expand Down
15 changes: 15 additions & 0 deletions resources/layouts/partials/metatags.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@
{%- set twitter = twitter|merge(page.social.twitter|default(site.social.twitter)) %}
{%- endif %}
{% endif %}
{# Mastodon #}
{% set mastodon = {
'creator': '',
} %}
{% if page.social.mastodon is defined or site.social.mastodon is defined %}
{%- if page.social.mastodon|default(site.social.mastodon) is not iterable %}
{%- set mastodon = mastodon|merge({'creator': page.social.mastodon|default(site.social.mastodon)}) %}
{%- else %}
{%- set mastodon = mastodon|merge(page.social.mastodon|default(site.social.mastodon)) %}
{%- endif %}
{% endif %}
{%- block content %}
{#~ template ~#}
<title>{% block title %}{{ title_html }}{% endblock %}</title>
Expand Down Expand Up @@ -226,6 +237,10 @@
{%- if twitter.creator ~%}
<meta name="twitter:creator" content="@{{ twitter.creator }}" />
{%- endif ~%}
{#- template: Mastodon ~#}
{%- if mastodon.creator ~%}
<meta name="fediverse:creator" content="{{ mastodon.creator }}">
{%- endif ~%}
{#- template: json-ld ~#}
{%- include 'partials/jsonld.js.twig' with {'author': author, 'favicon_asset': favicon_asset|default} ~%}
{%- endblock ~%}
Loading