mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-14 22:48:50 +02:00
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.
This commit is contained in:
@@ -23,13 +23,17 @@
|
|||||||
<meta property="og:type" content="{% if page.url == '/' %}website{% else %}article{% endif %}">
|
<meta property="og:type" content="{% if page.url == '/' %}website{% else %}article{% endif %}">
|
||||||
<meta property="og:description" content="{{ ogDesc }}">
|
<meta property="og:description" content="{{ ogDesc }}">
|
||||||
<meta name="description" content="{{ ogDesc }}">
|
<meta name="description" content="{{ ogDesc }}">
|
||||||
{# Compute OG slug from page.url — NOT permalink or eleventyComputed values.
|
{# Compute OG slug inline from page.url using string ops — avoid filter calls
|
||||||
Eleventy 3.x parallel rendering (issue #3183) cross-contaminates eleventyComputed
|
which may be affected by Eleventy 3.x parallel rendering race conditions.
|
||||||
return values across pages. permalink is set by eleventyComputed and is UNRELIABLE.
|
page.url is correct (verified via og:url), compute slug inline. #}
|
||||||
page.url is set by Eleventy's internal pipeline and IS correct in templates
|
{% set _urlParts = page.url.split('/') | reject("equalto", "") | list %}
|
||||||
(verified: og:url uses page.url and always shows the right URL). #}
|
{% if _urlParts | length >= 5 %}
|
||||||
{% set _ogSlug = page.url | ogSlug %}
|
{% set _ogSlug = _urlParts[1] + '-' + _urlParts[2] + '-' + _urlParts[3] + '-' + _urlParts[4] %}
|
||||||
|
{% else %}
|
||||||
|
{% set _ogSlug = _urlParts | last | default("") %}
|
||||||
|
{% endif %}
|
||||||
{% set _hasOg = _ogSlug | hasOgImage %}
|
{% set _hasOg = _ogSlug | hasOgImage %}
|
||||||
|
<!-- debug:og page.url={{ page.url }} permalink={{ permalink }} ogSlug={{ _ogSlug }} -->
|
||||||
{% if ogPhoto and ogPhoto != "" and (ogPhoto | length) > 10 %}
|
{% 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 %}">
|
<meta property="og:image" content="{% if 'http' in ogPhoto %}{{ ogPhoto }}{% else %}{{ site.url }}{% if ogPhoto[0] != '/' %}/{% endif %}{{ ogPhoto }}{% endif %}">
|
||||||
{% elif image and image != "" and (image | length) > 10 %}
|
{% elif image and image != "" and (image | length) > 10 %}
|
||||||
|
|||||||
Reference in New Issue
Block a user