Skip to content

Commit

Permalink
add title_meta to blog frontMatter schema
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 31, 2024
1 parent 8e9b5a3 commit e4e6bb8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ describe('validateBlogPostFrontMatter title', () => {
{title: ''},
{title: 'title'},
],
invalidFrontMatters: [
[{title: null}, 'must be a string'],
[{title: false}, 'must be a string'],
],
});
});

describe('validateBlogPostFrontMatter title_meta', () => {
testField({
prefix: 'title_meta',
validFrontMatters: [{title: ''}, {title_meta: 'title'}],
invalidFrontMatters: [
[{title_meta: null}, 'must be a string'],
[{title_meta: false}, 'must be a string'],
],
});
});

Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus-plugin-content-blog/src/frontMatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const FrontMatterAuthorErrorMessage =
const BlogFrontMatterSchema = Joi.object<BlogPostFrontMatter>({
id: Joi.string(),
title: Joi.string().allow(''),
title_meta: Joi.string(),
description: Joi.string().allow(''),
tags: FrontMatterTagsSchema,
date: Joi.date().raw(),
Expand Down

0 comments on commit e4e6bb8

Please sign in to comment.