From 520bc5f582c6b4ce51eef9480c25daa091734d54 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Tue, 24 Feb 2026 19:39:59 +0100 Subject: [PATCH] debug: inline ogSlug computation + debug comment to diagnose race condition Computes ogSlug using inline Nunjucks string ops instead of filter call. Adds HTML debug comment showing page.url, permalink, and computed ogSlug to diagnose Eleventy 3.x parallel rendering race condition. --- _includes/layouts/base.njk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 3ded1d2..5bc99b3 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -23,13 +23,17 @@ - {# 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 %} + {# Compute OG slug inline from page.url using string ops — avoid filter calls + which may be affected by Eleventy 3.x parallel rendering race conditions. + page.url is correct (verified via og:url), compute slug inline. #} + {% set _urlParts = page.url.split('/') | reject("equalto", "") | list %} + {% if _urlParts | length >= 5 %} + {% set _ogSlug = _urlParts[1] + '-' + _urlParts[2] + '-' + _urlParts[3] + '-' + _urlParts[4] %} + {% else %} + {% set _ogSlug = _urlParts | last | default("") %} + {% endif %} {% set _hasOg = _ogSlug | hasOgImage %} + {% if ogPhoto and ogPhoto != "" and (ogPhoto | length) > 10 %} {% elif image and image != "" and (image | length) > 10 %}