fix: use page.url instead of permalink for ogSlug in templates

permalink is set by eleventyComputed which cross-contaminates return
values across pages during Eleventy 3.x parallel rendering. page.url
is set by Eleventy's internal pipeline and is correct in templates
(verified via og:url meta tag which always shows the right URL).
This commit is contained in:
Ricardo
2026-02-24 18:54:39 +01:00
parent 7110ba3879
commit ad8af6f027

View File

@@ -23,10 +23,12 @@
<meta property="og:type" content="{% if page.url == '/' %}website{% else %}article{% endif %}">
<meta property="og:description" content="{{ ogDesc }}">
<meta name="description" content="{{ ogDesc }}">
{# Compute OG slug from permalink (frontmatter), NOT page.url or eleventyComputed.
permalink is per-file data immune to Eleventy 3.x parallel rendering race conditions.
page.url, page.inputPath, and eleventyComputed values can return data from OTHER pages. #}
{% set _ogSlug = permalink | ogSlug %}
{# Compute OG slug from page.url — NOT permalink or eleventyComputed values.
Eleventy 3.x parallel rendering (issue #3183) cross-contaminates eleventyComputed
return values across pages. permalink is set by eleventyComputed and is UNRELIABLE.
page.url is set by Eleventy's internal pipeline and IS correct in templates
(verified: og:url uses page.url and always shows the right URL). #}
{% set _ogSlug = page.url | ogSlug %}
{% set _hasOg = _ogSlug | hasOgImage %}
{% if ogPhoto and ogPhoto != "" and (ogPhoto | length) > 10 %}
<meta property="og:image" content="{% if 'http' in ogPhoto %}{{ ogPhoto }}{% else %}{{ site.url }}{% if ogPhoto[0] != '/' %}/{% endif %}{{ ogPhoto }}{% endif %}">