From 91326985d8252df5e962be3b13265f8eb48e1bb5 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 15 Jun 2023 11:14:47 +0200 Subject: [PATCH 1/6] improve SEO docs --- website/docs/seo.mdx | 57 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/website/docs/seo.mdx b/website/docs/seo.mdx index a16d3a80d95d..6ce74ce855a9 100644 --- a/website/docs/seo.mdx +++ b/website/docs/seo.mdx @@ -14,13 +14,40 @@ Docusaurus supports search engine optimization in a variety of ways. ## Global metadata {#global-metadata} -Provide global meta attributes for the entire site through the [site configuration](./configuration.mdx#site-metadata). The metadata will all be rendered in the HTML `` using the key-value pairs as the prop name and value. +Provide global meta attributes for the entire site through the [site configuration](./configuration.mdx#site-metadata). The metadata will all be rendered in the HTML `` using the key-value pairs as the prop name and value. The `metadata` attribute is a convenient shortcut to declare `` tags, but it is also possible inject arbitrary tags in `` with the `headTags` attribute. ```js title="docusaurus.config.js" module.exports = { themeConfig: { - metadata: [{name: 'keywords', content: 'cooking, blog'}], - // This would become in the generated HTML + // Declare some tags + metadata: [ + {name: 'keywords', content: 'cooking, blog'}, + {name: 'twitter:card', content: 'summary_large_image'}, + ], + headTags: [ + // Declare a preconnect tag + { + tagName: 'link', + attributes: { + rel: 'preconnect', + href: 'https://example.com', + }, + }, + // Declare some json-ld structured data + { + tagName: 'script', + attributes: { + type: 'application/ld+json', + }, + innerHTML: JSON.stringify({ + '@context': 'https://schema.org/', + '@type': 'Organization', + name: 'Meta Open Source', + url: 'https://opensource.fb.com/', + logo: 'https://opensource.fb.com/img/logos/Meta-Open-Source.svg', + }), + }, + ], }, }; ``` @@ -37,7 +64,18 @@ Similar to [global metadata](#global-metadata), Docusaurus also allows for the a # A cooking guide - + + + + Some content... @@ -74,6 +112,17 @@ export default function page() { + + + {/* ... */} From 9453d835c307189f197ebba77e4c79b031a552dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Thu, 15 Jun 2023 14:26:45 +0200 Subject: [PATCH 2/6] Update website/docs/seo.mdx Co-authored-by: Thad Guidry --- website/docs/seo.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/seo.mdx b/website/docs/seo.mdx index 6ce74ce855a9..165b664885b5 100644 --- a/website/docs/seo.mdx +++ b/website/docs/seo.mdx @@ -14,7 +14,7 @@ Docusaurus supports search engine optimization in a variety of ways. ## Global metadata {#global-metadata} -Provide global meta attributes for the entire site through the [site configuration](./configuration.mdx#site-metadata). The metadata will all be rendered in the HTML `` using the key-value pairs as the prop name and value. The `metadata` attribute is a convenient shortcut to declare `` tags, but it is also possible inject arbitrary tags in `` with the `headTags` attribute. +Provide global meta attributes for the entire site through the [site configuration](./configuration.mdx#site-metadata). The metadata will all be rendered in the HTML `` using the key-value pairs as the prop name and value. The `metadata` attribute is a convenient shortcut to declare `` tags, but it is also possible to inject arbitrary tags in `` with the `headTags` attribute. ```js title="docusaurus.config.js" module.exports = { From 460ab573b431dc1e33401ce5185a4b4de07d62ac Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 15 Jun 2023 15:11:35 +0200 Subject: [PATCH 3/6] Add support for missing shared metadata in MDX pages: title, description, keywords, image --- .../src/frontMatter.ts | 15 +++++++++----- .../src/index.ts | 10 +++++++++ .../src/plugin-content-pages.d.ts | 19 ++++++++++++++---- .../src/theme/MDXPage/index.tsx | 16 ++++++++++++--- .../_dogfooding/_pages tests/local-image.png | Bin 0 -> 7124 bytes website/_dogfooding/_pages tests/seo.md | 17 ++++++++++++++++ 6 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 website/_dogfooding/_pages tests/local-image.png create mode 100644 website/_dogfooding/_pages tests/seo.md diff --git a/packages/docusaurus-plugin-content-pages/src/frontMatter.ts b/packages/docusaurus-plugin-content-pages/src/frontMatter.ts index 87562de53e34..b87907adbd5f 100644 --- a/packages/docusaurus-plugin-content-pages/src/frontMatter.ts +++ b/packages/docusaurus-plugin-content-pages/src/frontMatter.ts @@ -10,12 +10,17 @@ import { validateFrontMatter, FrontMatterTOCHeadingLevels, ContentVisibilitySchema, + URISchema, } from '@docusaurus/utils-validation'; -import type {FrontMatter} from '@docusaurus/plugin-content-pages'; +import type {PageFrontMatter} from '@docusaurus/plugin-content-pages'; -const PageFrontMatterSchema = Joi.object({ - title: Joi.string(), - description: Joi.string(), +const PageFrontMatterSchema = Joi.object({ + // See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398 + title: Joi.string().allow(''), + // See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398 + description: Joi.string().allow(''), + keywords: Joi.array().items(Joi.string().required()), + image: URISchema, wrapperClassName: Joi.string(), hide_table_of_contents: Joi.boolean(), ...FrontMatterTOCHeadingLevels, @@ -23,6 +28,6 @@ const PageFrontMatterSchema = Joi.object({ export function validatePageFrontMatter(frontMatter: { [key: string]: unknown; -}): FrontMatter { +}): PageFrontMatter { return validateFrontMatter(frontMatter, PageFrontMatterSchema); } diff --git a/packages/docusaurus-plugin-content-pages/src/index.ts b/packages/docusaurus-plugin-content-pages/src/index.ts index f65cd49a1815..e62d07c6cbaf 100644 --- a/packages/docusaurus-plugin-content-pages/src/index.ts +++ b/packages/docusaurus-plugin-content-pages/src/index.ts @@ -31,6 +31,7 @@ import type { PluginOptions, Metadata, LoadedContent, + PageFrontMatter, } from '@docusaurus/plugin-content-pages'; export function getContentPathList(contentPaths: PagesContentPaths): string[] { @@ -234,6 +235,15 @@ export default function pluginContentPages( `${docuHash(aliasedSource)}.json`, ); }, + // Assets allow to convert some relative images paths to + // require(...) calls + createAssets: ({ + frontMatter, + }: { + frontMatter: PageFrontMatter; + }) => ({ + image: frontMatter.image, + }), markdownConfig: siteConfig.markdown, }, }, diff --git a/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts b/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts index 09279828392a..f0a9230cdee0 100644 --- a/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts +++ b/packages/docusaurus-plugin-content-pages/src/plugin-content-pages.d.ts @@ -9,6 +9,10 @@ declare module '@docusaurus/plugin-content-pages' { import type {MDXOptions} from '@docusaurus/mdx-loader'; import type {LoadContext, Plugin} from '@docusaurus/types'; + export type Assets = { + image?: string; + }; + export type PluginOptions = MDXOptions & { id?: string; path: string; @@ -20,9 +24,11 @@ declare module '@docusaurus/plugin-content-pages' { export type Options = Partial; - export type FrontMatter = { + export type PageFrontMatter = { readonly title?: string; readonly description?: string; + readonly image?: string; + readonly keywords?: string[]; readonly wrapperClassName?: string; readonly hide_table_of_contents?: string; readonly toc_min_heading_level?: number; @@ -41,7 +47,7 @@ declare module '@docusaurus/plugin-content-pages' { type: 'mdx'; permalink: string; source: string; - frontMatter: FrontMatter & {[key: string]: unknown}; + frontMatter: PageFrontMatter & {[key: string]: unknown}; title?: string; description?: string; unlisted: boolean; @@ -61,11 +67,16 @@ declare module '@theme/MDXPage' { import type {LoadedMDXContent} from '@docusaurus/mdx-loader'; import type { MDXPageMetadata, - FrontMatter, + PageFrontMatter, + Assets, } from '@docusaurus/plugin-content-pages'; export interface Props { - readonly content: LoadedMDXContent; + readonly content: LoadedMDXContent< + PageFrontMatter, + MDXPageMetadata, + Assets + >; } export default function MDXPage(props: Props): JSX.Element; diff --git a/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx b/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx index 6d865b91ea6f..c9222ad0b532 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx @@ -24,9 +24,14 @@ export default function MDXPage(props: Props): JSX.Element { const {content: MDXPageContent} = props; const { metadata: {title, description, frontMatter, unlisted}, + assets, } = MDXPageContent; - const {wrapperClassName, hide_table_of_contents: hideTableOfContents} = - frontMatter; + const { + keywords, + wrapperClassName, + hide_table_of_contents: hideTableOfContents, + } = frontMatter; + const image = assets.image ?? frontMatter.image; return ( - +
diff --git a/website/_dogfooding/_pages tests/local-image.png b/website/_dogfooding/_pages tests/local-image.png new file mode 100644 index 0000000000000000000000000000000000000000..0b1e98a2f06bb895e37c57b389a6c7fa87678250 GIT binary patch literal 7124 zcmZ`;XIPWX(xxdYh_6Ufnu_$^B}h}G_uhMv5)eq}O%zdj37|j#HKB$cdI^Gb2oRc7 zC6tiRlq&rM-}CSL&Y#Wm>@}IaXXf77nP=bY>8Rekaqk8R3CT@$HDv=560$$U=lpAA z#PNVEiIRkbIa^&>$tZAUbN;%SF%H_})2vk(<}!nSGKL&;lieJA5;W5%G3KdVAZ4S> zAg$Ma^En-(A{`^0J_G4((t108$IlNWecUiij^i)19LAaUS%lV|)2)S?8DBm(UyW#d zd;dP!L#wT`olv&Cfqfxd&Y|4)$&%c*jO+KwV*n9FoJ71f@#os*GX*Pgh@v45NS?m3oQg2#IdG9xi%ck)(5=M0# zes{P;KRAC(Xn}La%++8wQ%{?&OG8t@Bt#4!@W||T%$*uPTjuQQ7SqLo&ITPPX8`jZ zqK%PvwVI1dX#^Fvq4ge5gU!6fhb}y8LwvX2pog1Xz3e;5h=`daQjD9TpGRcp-1f+R zjPmA?9?sook@EbmAipDQeUmUa@5JNCL4GOuSXA-~DWgJe%2~^6fBU>7t=hxp{j7^H zASm;q*5Kj_GYfH1MbvL$z=({Erv&5*UN>l^O_HDF%95FJRIeYsMic`NFabOIHXb5(hlDP+Q9W+ zvxO40&6V&ZL^Nx)@A{3@#VrXXOVpeNEaI|*Ff-pTEdyp>Cfxn} z{ALyIu(GlqE;Q3Uy!2yvEmTzg!;uQ(LB_e_?}TcvtKMYfUGu_B*d(N+f`fy*ySw|B)~70N zvCFqqH6C&H-zNH_eVzisvM!$z{}^}F>oR+BBh=#bH~G}bpmYuBt2g10(MEVvY>bKe zs;X*FVQ#SdLQ4>>vzG4GbPYEbSNC2+adBTyk85}QT{Id!TL(;YJ+N)ncyP(XwHKP! zwNufo^R}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ndkTe_?u+>2}L{hXvRuB7A^6`-`K?v3;V>8-RNffhW2;((=b; zw{_-!^_BZ>wR=U;(mguH*J6uGVfqSCu(QzP^&7;7hRJsq@`Zl(BF*^ilzhc4 z$*=puB%=KKIY@c!_ic|vj}C=VWtK7JIvcx}^F7`7Y3JR~>>Y(}7u@M}v}C6WTG%5C zg16W#aBipTCJ(3RrVT@MGlnz0Q?^sRTf&@|{kl0ny}SHm=7H3!l_`q{dPz5OTl(y{ z3|wAtR5Do_H-}D42MS*SKg|cE-Xy#14YAln2b6lPqwJ*!$z^Z(zc06l&G!Gk+?vE* Zklyd31cs0WsS(9U)Sv4pmp`?O`VW|F#*hF2 literal 0 HcmV?d00001 diff --git a/website/_dogfooding/_pages tests/seo.md b/website/_dogfooding/_pages tests/seo.md new file mode 100644 index 000000000000..dd6a1903fffa --- /dev/null +++ b/website/_dogfooding/_pages tests/seo.md @@ -0,0 +1,17 @@ +--- +title: custom SEO title +description: custom SEO description +keywords: [custom, keywords] +image: ./local-image.png +--- + +# SEO tests + +Using page SEO front matter: + +```yaml +title: custom SEO title +description: custom SEO description +keywords: [custom, keywords] +image: ./local-image.png +``` From ccbb29dc47c701438d72714381ce80f8b636a2d7 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 15 Jun 2023 15:35:33 +0200 Subject: [PATCH 4/6] add useful front matter SEO linking --- website/docs/api/plugins/plugin-content-blog.mdx | 2 +- website/docs/api/plugins/plugin-content-docs.mdx | 2 +- website/docs/api/plugins/plugin-content-pages.mdx | 6 ++++-- .../markdown-features/markdown-features-intro.mdx | 10 ++++++++++ website/docs/seo.mdx | 14 ++++++++++++-- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/website/docs/api/plugins/plugin-content-blog.mdx b/website/docs/api/plugins/plugin-content-blog.mdx index 68c0515dfff8..52212f8b56c1 100644 --- a/website/docs/api/plugins/plugin-content-blog.mdx +++ b/website/docs/api/plugins/plugin-content-blog.mdx @@ -194,7 +194,7 @@ const config = { ## Markdown front matter {#markdown-front-matter} -Markdown documents can use the following Markdown front matter metadata fields, enclosed by a line `---` on either side. +Markdown documents can use the following Markdown [front matter](../../guides/markdown-features/markdown-features-intro.mdx#front-matter) metadata fields, enclosed by a line `---` on either side. Accepted fields: diff --git a/website/docs/api/plugins/plugin-content-docs.mdx b/website/docs/api/plugins/plugin-content-docs.mdx index 8a731e4b6a53..31a44f221e52 100644 --- a/website/docs/api/plugins/plugin-content-docs.mdx +++ b/website/docs/api/plugins/plugin-content-docs.mdx @@ -261,7 +261,7 @@ const config = { ## Markdown front matter {#markdown-front-matter} -Markdown documents can use the following Markdown front matter metadata fields, enclosed by a line `---` on either side. +Markdown documents can use the following Markdown [front matter](../../guides/markdown-features/markdown-features-intro.mdx#front-matter) metadata fields, enclosed by a line `---` on either side. Accepted fields: diff --git a/website/docs/api/plugins/plugin-content-pages.mdx b/website/docs/api/plugins/plugin-content-pages.mdx index eaefe2ff8db5..d2976d0fbbad 100644 --- a/website/docs/api/plugins/plugin-content-pages.mdx +++ b/website/docs/api/plugins/plugin-content-pages.mdx @@ -81,7 +81,7 @@ const config = { ## Markdown front matter {#markdown-front-matter} -Markdown pages can use the following Markdown front matter metadata fields, enclosed by a line `---` on either side. +Markdown pages can use the following Markdown [front matter](../../guides/markdown-features/markdown-features-intro.mdx#front-matter) metadata fields, enclosed by a line `---` on either side. Accepted fields: @@ -93,7 +93,9 @@ Accepted fields: | --- | --- | --- | --- | | `title` | `string` | Markdown title | The blog post title. | | `description` | `string` | The first line of Markdown content | The description of your page, which will become the `` and `` in ``, used by search engines. | -| `wrapperClassName` | `string` | Class name to be added to the wrapper element to allow targeting specific page content. | +| `keywords` | `string[]` | `undefined` | Keywords meta tag, which will become the `` in ``, used by search engines. | +| `image` | `string` | `undefined` | Cover or thumbnail image that will be used when displaying the link to your post. | +| `wrapperClassName` | `string` | | Class name to be added to the wrapper element to allow targeting specific page content. | | `hide_table_of_contents` | `boolean` | `false` | Whether to hide the table of contents to the right. | | `draft` | `boolean` | `false` | Draft pages will only be available during development. | | `unlisted` | `boolean` | `false` | Unlisted pages will be available in both development and production. They will be "hidden" in production, not indexed, excluded from sitemaps, and can only be accessed by users having a direct link. | diff --git a/website/docs/guides/markdown-features/markdown-features-intro.mdx b/website/docs/guides/markdown-features/markdown-features-intro.mdx index 30212e50042f..cf294ac6f090 100644 --- a/website/docs/guides/markdown-features/markdown-features-intro.mdx +++ b/website/docs/guides/markdown-features/markdown-features-intro.mdx @@ -72,6 +72,16 @@ more_data: --- ``` +:::info + +The API documentation of each official plugin lists the supported attributes: + +- [Docs front matter](./api/plugins/plugin-content-docs.mdx#markdown-front-matter) +- [Blog front matter](./api/plugins/plugin-content-blog.mdx#markdown-front-matter) +- [Pages front matter](./api/plugins/plugin-content-pages.mdx#markdown-front-matter) + +::: + ## Quotes {#quotes} Markdown quotes are beautifully styled: diff --git a/website/docs/seo.mdx b/website/docs/seo.mdx index 165b664885b5..048a23a66808 100644 --- a/website/docs/seo.mdx +++ b/website/docs/seo.mdx @@ -81,7 +81,7 @@ Similar to [global metadata](#global-metadata), Docusaurus also allows for the a Some content... ``` -Docusaurus automatically adds `description`, `title`, canonical URL links, and other useful metadata to each Markdown page. They are configurable through front matter: +Docusaurus automatically adds `description`, `title`, canonical URL links, and other useful metadata to each Markdown page. They are configurable through [front matter](./guides/markdown-features/markdown-features-intro.mdx#front-matter): ```md --- @@ -96,7 +96,17 @@ When creating your React page, adding these fields in `Layout` would also improv :::tip -Prefer to use front matter for fields like `description` and `keywords`: Docusaurus will automatically apply this to both `description` and `og:description`, while you would have to manually declare two metadata tags when using the `` tag. +Prefer to use [front matter](./guides/markdown-features/markdown-features-intro.mdx#front-matter) for fields like `description` and `keywords`: Docusaurus will automatically apply this to both `description` and `og:description`, while you would have to manually declare two metadata tags when using the `` tag. + +::: + +:::info + +The official plugins all support the following [front matter](./guides/markdown-features/markdown-features-intro.mdx#front-matter): `title`, `description`, `keywords` and `image`. Refer to their respective API documentation for additional [front matter](./guides/markdown-features/markdown-features-intro.mdx#front-matter) support: + +- [Docs front matter](./api/plugins/plugin-content-docs.mdx#markdown-front-matter) +- [Blog front matter](./api/plugins/plugin-content-blog.mdx#markdown-front-matter) +- [Pages front matter](./api/plugins/plugin-content-pages.mdx#markdown-front-matter) ::: From bc068e15a7220171c3e96d7151b5eea6bd2534d3 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 15 Jun 2023 15:42:38 +0200 Subject: [PATCH 5/6] broken links --- .../guides/markdown-features/markdown-features-intro.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/guides/markdown-features/markdown-features-intro.mdx b/website/docs/guides/markdown-features/markdown-features-intro.mdx index cf294ac6f090..2da413878351 100644 --- a/website/docs/guides/markdown-features/markdown-features-intro.mdx +++ b/website/docs/guides/markdown-features/markdown-features-intro.mdx @@ -76,9 +76,9 @@ more_data: The API documentation of each official plugin lists the supported attributes: -- [Docs front matter](./api/plugins/plugin-content-docs.mdx#markdown-front-matter) -- [Blog front matter](./api/plugins/plugin-content-blog.mdx#markdown-front-matter) -- [Pages front matter](./api/plugins/plugin-content-pages.mdx#markdown-front-matter) +- [Docs front matter](../../api/plugins/plugin-content-docs.mdx#markdown-front-matter) +- [Blog front matter](../../api/plugins/plugin-content-blog.mdx#markdown-front-matter) +- [Pages front matter](../../api/plugins/plugin-content-pages.mdx#markdown-front-matter) ::: From 4b4dd9590b4223bcb572af6b37e1ad74e6bd6850 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 15 Jun 2023 16:01:45 +0200 Subject: [PATCH 6/6] empty