refactor: ♻️ move data up in the data cascade

In order for og-image generation to not generate broken previews the flow of data needs to be handled differently. This also makes metadata generation more predictable.
This commit is contained in:
Sebin Nyshkim 2025-05-18 17:12:11 +02:00
parent ddbad1d1a2
commit d2a9ec7936
6 changed files with 26 additions and 40 deletions

View file

@ -2,16 +2,17 @@
<html lang="en">
<head>
{% metagen
title = title + ' - Sebin\'s Blog',
title = page_title,
desc = page.excerpt | toPlain,
url = 'https://blog.sebin-nyshkim.net' + page.url,
type = type,
site_name = 'Sebin\'s Blog',
og_title = title,
site_name = site_name,
og_title = og_title,
og_image_width = image.width,
og_image_height = image.height,
og_image_alt = image.alt,
og_image_type = 'image/webp',
twitter_title = og_title,
twitter_card_type = twitter.cardType,
name = author.name,
generator = eleventy.generator,
@ -23,7 +24,7 @@
'/css/style.css',
'/css/prism.css']
%}
{% ogImage "og-image.og.njk", { title: title, author: author, image: image } %}
{% ogImage "og-image.og.njk", { title: title or site_name, author: author, image: image } %}
{% if mastodon.fediverseCreator and mastodon.fediverseCreator != '' %}
<meta name="fediverse:creator" content="{{ mastodon.fediverseCreator }}" />
{% endif %}
@ -36,7 +37,7 @@
<div class="flex min-h-16 max-w-(--breakpoint-xl) items-center justify-center bg-sky-600 shadow-xl sm:m-4 sm:mx-auto sm:justify-between sm:rounded-xl dark:bg-sky-950">
<div class="hidden sm:flex sm:items-center">
<img src="https://img.sebin-nyshkim.net/i/b6629b72-ab77-4a6c-bf97-b1a615cc2454" alt="" class="m-4 max-w-12 rounded-full border-4 border-white shadow-2xl lg:m-5 lg:max-w-14">
<h1 class="text-2xl text-white lg:text-3xl">Sebin's Blog</h1>
<h1 class="text-2xl text-white lg:text-3xl">{{ site_name }}</h1>
</div>
<nav class="eleventy-navigation" aria-label="Main">
{{