mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-28 14:08:21 +02:00
feat(blog): Add frontMatter.title_meta
to override title for SEO (#10586)
Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
parent
5c1ce0137c
commit
5cf2c39836
5 changed files with 23 additions and 1 deletions
|
@ -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'],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -143,6 +143,11 @@ declare module '@docusaurus/plugin-content-blog' {
|
|||
* @see {@link BlogPostMetadata.title}
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Will be used for SEO page metadata and override BlogPostMetadata.title.
|
||||
* @see {@link BlogPostMetadata.title_meta}
|
||||
*/
|
||||
title_meta?: string;
|
||||
/**
|
||||
* Will override the default excerpt.
|
||||
* @see {@link BlogPostMetadata.description}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue