Update content page background
This commit is contained in:
+16
-2
@@ -54,6 +54,17 @@ export const BLOG_POST_SCHEMA = {
|
||||
},
|
||||
},
|
||||
},
|
||||
background: {
|
||||
type: "object",
|
||||
required: false,
|
||||
default: null,
|
||||
properties: {
|
||||
color: {
|
||||
type: "string",
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -149,8 +160,11 @@ export function sanitizeBlogPost(frontmatter) {
|
||||
|
||||
for (const [field, config] of Object.entries(BLOG_POST_SCHEMA)) {
|
||||
if (frontmatter[field] !== undefined) {
|
||||
// Special handling for thumbnail object
|
||||
if (field === "thumbnail" && typeof frontmatter[field] === "object") {
|
||||
// Special handling for thumbnail and background objects
|
||||
if (
|
||||
(field === "thumbnail" || field === "background") &&
|
||||
typeof frontmatter[field] === "object"
|
||||
) {
|
||||
sanitized[field] = frontmatter[field];
|
||||
} else {
|
||||
sanitized[field] = frontmatter[field];
|
||||
|
||||
Reference in New Issue
Block a user