mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-14 22:48:50 +02:00
fix: show Fediverse button from mpSyndicateTo before syndication runs
The Fediverse button only appeared after the syndication endpoint wrote the syndication array to frontmatter. If the Eleventy watcher missed the second file update (timing race), the button never showed. Now falls back to mpSyndicateTo — which is written at post creation time — to render the button on the first build. Once syndication populates the syndication array, it takes over.
This commit is contained in:
@@ -112,6 +112,16 @@ withBlogSidebar: true
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{# Fallback: if no selfHostedApUrl from syndication yet, check mpSyndicateTo.
|
||||||
|
This ensures the Fediverse button appears on the first build, before the
|
||||||
|
syndication endpoint has run and added the URL to the syndication array. #}
|
||||||
|
{% if not selfHostedApUrl and mpSyndicateTo %}
|
||||||
|
{% for url in mpSyndicateTo %}
|
||||||
|
{% if url.indexOf(site.url) == 0 %}
|
||||||
|
{% set selfHostedApUrl = page.url | url %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% if externalSyndication.length or selfHostedApUrl %}
|
{% if externalSyndication.length or selfHostedApUrl %}
|
||||||
<footer class="post-footer mt-8 pt-6 border-t border-surface-200 dark:border-surface-700">
|
<footer class="post-footer mt-8 pt-6 border-t border-surface-200 dark:border-surface-700">
|
||||||
<div class="flex flex-wrap items-center gap-4">
|
<div class="flex flex-wrap items-center gap-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user