diff --git a/app/components/ContentBanner.js b/app/components/ContentBanner.js index d3cc397..75ff265 100644 --- a/app/components/ContentBanner.js +++ b/app/components/ContentBanner.js @@ -4,7 +4,7 @@ import { getAssetPath } from "../../lib/assetUtils"; import ContentContainer from "./ContentContainer"; export default function ContentBanner({ post }) { - // Get article-specific background image + // Get article-specific horizontal thumbnail (small) and banner (md+) const getBackgroundImage = (post) => { if (post.frontmatter?.thumbnail?.horizontal) { return `/content/blog/${post.frontmatter.thumbnail.horizontal}`; @@ -13,7 +13,16 @@ export default function ContentBanner({ post }) { return getAssetPath("assets/Content_Banner.svg"); }; + const getBannerImageMd = (post) => { + // Use banner.horizontal when provided; fallback to default banner asset + if (post.frontmatter?.banner?.horizontal) { + return `/content/blog/${post.frontmatter.banner.horizontal}`; + } + return getAssetPath("assets/Content_Banner_2.svg"); + }; + const backgroundImage = getBackgroundImage(post); + const bannerImageMd = getBannerImageMd(post); return (
@@ -26,11 +35,11 @@ export default function ContentBanner({ post }) { }} /> - {/* Background SVG - md breakpoint and above */} + {/* Background SVG - md breakpoint and above (article banner image) */}
diff --git a/content/blog/operational-security-mutual-aid.md b/content/blog/operational-security-mutual-aid.md index 4ebcd35..601879f 100644 --- a/content/blog/operational-security-mutual-aid.md +++ b/content/blog/operational-security-mutual-aid.md @@ -7,6 +7,8 @@ related: ["resolving-active-conflicts", "making-decisions-without-hierarchy"] thumbnail: vertical: "operational-security-mutual-aid-vertical.svg" horizontal: "operational-security-mutual-aid-horizontal.svg" +banner: + horizontal: "operational-security-mutual-aid-banner.svg" background: color: "#F4F3F1" --- diff --git a/docs/CONTENT_CREATION_GUIDE.md b/docs/CONTENT_CREATION_GUIDE.md index fa6e3b0..c0991b7 100644 --- a/docs/CONTENT_CREATION_GUIDE.md +++ b/docs/CONTENT_CREATION_GUIDE.md @@ -48,6 +48,8 @@ related: ["slug-of-related-article-1", "slug-of-related-article-2"] thumbnail: vertical: "your-article-slug-vertical.svg" horizontal: "your-article-slug-horizontal.svg" +banner: + horizontal: "your-article-slug-banner.svg" # md+ breakpoint banner image background: color: "#F4F3F1" # Page background color (hex) --- @@ -61,6 +63,7 @@ background: - **date**: Publication date in YYYY-MM-DD format - **related**: Array of article slugs (use filename without .md) - **thumbnail**: Custom images for article thumbnails (optional) +- **banner.horizontal**: Banner image for md+ breakpoints (optional) - **background.color**: Page background color as a hex code (e.g., `#F4F3F1`) ### Related Articles @@ -90,16 +93,19 @@ Add custom thumbnail images to make your article stand out: - Horizontal: 320px × 225.5px (minimum width) - Format: SVG preferred, PNG also works -2. **Save in content/blog/**: +2. **Save in public/content/blog/**: - `your-article-slug-vertical.svg` - `your-article-slug-horizontal.svg` + - `your-article-slug-banner.svg` (optional, for md+ breakpoints) 3. **Add to frontmatter**: ```yaml thumbnail: vertical: "your-article-slug-vertical.svg" horizontal: "your-article-slug-horizontal.svg" + banner: + horizontal: "your-article-slug-banner.svg" ``` If no thumbnails are provided, default images will be used. diff --git a/lib/validation.js b/lib/validation.js index 91237d2..7409b49 100644 --- a/lib/validation.js +++ b/lib/validation.js @@ -54,6 +54,17 @@ export const BLOG_POST_SCHEMA = { }, }, }, + banner: { + type: "object", + required: false, + default: null, + properties: { + horizontal: { + type: "string", + required: false, + }, + }, + }, background: { type: "object", required: false, @@ -162,7 +173,9 @@ export function sanitizeBlogPost(frontmatter) { if (frontmatter[field] !== undefined) { // Special handling for thumbnail and background objects if ( - (field === "thumbnail" || field === "background") && + (field === "thumbnail" || + field === "background" || + field === "banner") && typeof frontmatter[field] === "object" ) { sanitized[field] = frontmatter[field]; diff --git a/public/assets/Content_Banner_2.svg b/public/content/blog/operational-security-mutual-aid-banner.svg similarity index 100% rename from public/assets/Content_Banner_2.svg rename to public/content/blog/operational-security-mutual-aid-banner.svg