fix: use fileSlug instead of url to avoid circular dependency

The eleventyComputed permalink cannot reference page.url as it
creates a circular dependency (url depends on permalink).
Using fileSlug instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ricardo
2026-02-02 12:30:04 +01:00
parent 5e564d3403
commit 829395a2cd

View File

@@ -2,7 +2,7 @@
layout: layouts/base.njk
title: About
eleventyComputed:
permalink: "{% set aboutPageExists = false %}{% for page in collections.pages %}{% if page.url == '/about/' %}{% set aboutPageExists = true %}{% endif %}{% endfor %}{% if aboutPageExists %}false{% else %}/about/{% endif %}"
permalink: "{% set aboutPageExists = false %}{% for page in collections.pages %}{% if page.fileSlug == 'about' %}{% set aboutPageExists = true %}{% endif %}{% endfor %}{% if aboutPageExists %}false{% else %}/about/{% endif %}"
---
<article class="h-card">
<header class="mb-6 sm:mb-8 flex flex-col sm:flex-row gap-6 sm:gap-8 items-start">