docs: mention that SEO through front matter is better than head tag (#6112)

This commit is contained in:
Joshua Chen 2021-12-17 19:29:51 +08:00 committed by GitHub
parent 77c93cbda6
commit f84eb073e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -52,6 +52,12 @@ Open your browser DevTools and check how this page's metadata have been affected
:::
:::tip
**You don't always need this for typical SEO needs.** Content plugins (e.g. docs and blog) provide front matter options like `description`, `keywords`, and `image`, which will be automatically applied to both `description` and `og:description`, while you would have to manually declare two metadata tags when using the `<head>` tag.
:::
:::note
This feature is built on top of the Docusaurus [`<Head>`](./../../docusaurus-core.md#head) component.

View File

@ -69,6 +69,12 @@ keywords: [keywords, describing, the main topics]
When creating your React page, adding these fields in `Layout` would also improve SEO.
:::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 `<head>` tag.
:::
## Static HTML generation {#static-html-generation}
Docusaurus is a static site generator—HTML files are statically generated for every URL route, which helps search engines discover your content more easily.