Take the article page color from the section banner SVG so the body cannot drift from the hero on current or future posts.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import path from "path";
|
||||
import matter from "gray-matter";
|
||||
import { validateBlogPost, sanitizeBlogPost } from "./validation";
|
||||
import type { BlogPostFrontmatter } from "./validation";
|
||||
import { resolveBlogPageBackgroundColor } from "./blogSectionBackground";
|
||||
import { logger } from "./logger";
|
||||
|
||||
/**
|
||||
@@ -104,6 +105,14 @@ export function parseBlogPost(filePath: string): BlogPost | null {
|
||||
|
||||
const sanitizedFrontmatter = sanitizeBlogPost(data);
|
||||
const slug = generateSlug(filePath.replace(/\.mdx?$/, ""));
|
||||
const pageBackground = resolveBlogPageBackgroundColor({
|
||||
slug,
|
||||
bannerFileName: sanitizedFrontmatter.banner?.horizontal,
|
||||
frontmatterColor: sanitizedFrontmatter.background?.color,
|
||||
});
|
||||
if (pageBackground) {
|
||||
sanitizedFrontmatter.background = { color: pageBackground };
|
||||
}
|
||||
|
||||
return {
|
||||
slug,
|
||||
|
||||
Reference in New Issue
Block a user