From 0ab9889fc8e04fe82847f9c8a83d84e11050f19d Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Wed, 3 Jun 2026 08:15:01 +0100 Subject: [PATCH] Add video headers --- scripts/check-no-js.mjs | 1 + src/components/PostThumbnail.astro | 133 ++++++++------- src/components/ProjectList.astro | 115 +++++++++---- src/components/VideoThumbnail.astro | 134 +++++++++++++++ src/layouts/Post.astro | 13 +- src/lib/site.ts | 17 +- src/styles/global.css | 253 +++++++++++++++++++++++----- 7 files changed, 535 insertions(+), 131 deletions(-) create mode 100644 src/components/VideoThumbnail.astro diff --git a/scripts/check-no-js.mjs b/scripts/check-no-js.mjs index 7098320..051a252 100644 --- a/scripts/check-no-js.mjs +++ b/scripts/check-no-js.mjs @@ -57,6 +57,7 @@ const ANALYTICS_SCRIPT_SRC_PATTERN = function isSafeScriptTag(tag) { if (tag.includes('data-theme-script')) return true; if (tag.includes('data-thumbnail-iframe-script')) return true; + if (tag.includes('data-video-thumbnail-script')) return true; if (ANALYTICS_SCRIPT_SRC_PATTERN.test(tag)) return true; const typeMatch = tag.match(/\btype=["']([^"']+)["']/i); if (!typeMatch) return false; diff --git a/src/components/PostThumbnail.astro b/src/components/PostThumbnail.astro index 7723e23..bb74768 100644 --- a/src/components/PostThumbnail.astro +++ b/src/components/PostThumbnail.astro @@ -1,13 +1,15 @@ --- import { Picture } from 'astro:assets'; import type { CollectionEntry } from 'astro:content'; -import { absoluteUrl } from '../lib/site'; +import VideoThumbnail from './VideoThumbnail.astro'; +import { absoluteUrl, getHeaderVideo } from '../lib/site'; interface Props { post: CollectionEntry<'posts'>; } const { post } = Astro.props; +const headerVideo = getHeaderVideo(post); const demoLink = post.data.links.find( (link) => !link.download && link.label.trim().toLowerCase() === 'demo' ); @@ -54,66 +56,81 @@ for (const root of document.querySelectorAll('.post-thumbnail--iframe')) { `; --- -
- +{ + headerVideo ? ( + + ) : ( +
+ - { - iframeSrc && ( - <> - -