diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index b937f21..28c5ef9 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -1,14 +1,10 @@
- {# CRITICAL: Capture page.url IMMEDIATELY — Eleventy 3.x race condition (#3183) - causes page.url to change mid-render during parallel processing. - Nunjucks {% set %} captures the VALUE (not a reference), making it immune - to later mutations of the shared page object. This MUST be the first - statement in the template, before any filter calls that could yield. #} - {% set _pageUrl = page.url %} - {% set _ogSlug = (_pageUrl or "") | ogSlug %} - {% set _hasOg = _ogSlug | hasOgImage %} + {# OG image resolution handled by og-fix transform in eleventy.config.js + to bypass Eleventy 3.x parallel rendering race condition (#3183). + Template outputs __OG_IMAGE_PLACEHOLDER__ and __TWITTER_CARD_PLACEHOLDER__ + which the transform replaces using the correct slug derived from outputPath. #} @@ -25,11 +21,10 @@ {% set ogPhoto = ogPhoto[0] %} {% endif %} {% endif %} - - - + + {% if ogPhoto and ogPhoto != "" and (ogPhoto | length) > 10 %} @@ -38,18 +33,16 @@ {% elif contentImage and contentImage != "" and (contentImage | length) > 10 %} - {% elif _hasOg %} - {% else %} - + {% endif %} {# Twitter Card meta tags #} - {% set hasImage = _hasOg or (ogPhoto and ogPhoto != "" and (ogPhoto | length) > 10) or (image and image != "" and (image | length) > 10) or (contentImage and contentImage != "" and (contentImage | length) > 10) %} - + {% set hasExplicitImage = (ogPhoto and ogPhoto != "" and (ogPhoto | length) > 10) or (image and image != "" and (image | length) > 10) or (contentImage and contentImage != "" and (contentImage | length) > 10) %} + {% if ogPhoto and ogPhoto != "" and (ogPhoto | length) > 10 %} @@ -58,8 +51,8 @@ {% elif contentImage and contentImage != "" and (contentImage | length) > 10 %} - {% elif _hasOg %} - + {% else %} + {% endif %} {# Favicon #} @@ -102,17 +95,17 @@ [x-show*="loading"], button[\\@click*="fetch"], button[\\@click*="loadMore"] { display: none !important; } - + - {% if site.markdownAgents.enabled and _pageUrl and _pageUrl.startsWith('/articles/') %} - + {% if site.markdownAgents.enabled and page.url and page.url.startsWith('/articles/') %} + {% endif %} - + @@ -314,7 +307,7 @@