fix(create-docusaurus): Improve init templates blog setup + fix warnings (#10392)

This commit is contained in:
Sébastien Lorber 2024-08-12 15:59:03 +02:00 committed by GitHub
parent 471f0d4333
commit 547979a59f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 35 additions and 17 deletions

View file

@ -50,6 +50,10 @@ const config: Config = {
// Remove this to remove the "edit this page" links. // Remove this to remove the "edit this page" links.
editUrl: editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
// Useful options to enforce blogging best practices
onInlineTags: 'warn',
onInlineAuthors: 'warn',
onUntruncatedBlogPosts: 'warn',
}, },
theme: { theme: {
customCss: './src/css/custom.css', customCss: './src/css/custom.css',

View file

@ -56,6 +56,10 @@ const config = {
// Remove this to remove the "edit this page" links. // Remove this to remove the "edit this page" links.
editUrl: editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
// Useful options to enforce blogging best practices
onInlineTags: 'warn',
onInlineAuthors: 'warn',
onUntruncatedBlogPosts: 'warn',
}, },
theme: { theme: {
customCss: './src/css/custom.css', customCss: './src/css/custom.css',

View file

@ -1,12 +1,12 @@
--- ---
slug: first-blog-post slug: first-blog-post
title: First Blog Post title: First Blog Post
authors: authors: [slorber, yangshun]
name: Gao Wei
title: Docusaurus Core Team
url: https://github.com/wgao19
image_url: https://github.com/wgao19.png
tags: [hola, docusaurus] tags: [hola, docusaurus]
--- ---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet...
<!-- truncate -->
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

View file

@ -1,7 +1,7 @@
--- ---
slug: long-blog-post slug: long-blog-post
title: Long Blog Post title: Long Blog Post
authors: endi authors: yangshun
tags: [hello, docusaurus] tags: [hello, docusaurus]
--- ---

View file

@ -11,10 +11,14 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
Use the power of React to create interactive blog posts. Use the power of React to create interactive blog posts.
:::
{/* truncate */}
For example, use JSX to create an interactive button:
```js ```js
<button onClick={() => alert('button clicked!')}>Click me!</button> <button onClick={() => alert('button clicked!')}>Click me!</button>
``` ```
<button onClick={() => alert('button clicked!')}>Click me!</button> <button onClick={() => alert('button clicked!')}>Click me!</button>
:::

View file

@ -7,6 +7,10 @@ tags: [facebook, hello, docusaurus]
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog). [Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
Here are a few tips you might find useful.
<!-- truncate -->
Simply add Markdown files (or folders) to the `blog` directory. Simply add Markdown files (or folders) to the `blog` directory.
Regular blog authors can be added to `authors.yml`. Regular blog authors can be added to `authors.yml`.

View file

@ -1,14 +1,9 @@
endi:
name: Endilie Yacop Sucipto
title: Maintainer of Docusaurus
url: https://github.com/endiliey
image_url: https://github.com/endiliey.png
yangshun: yangshun:
name: Yangshun Tay name: Yangshun Tay
title: Front End Engineer @ Facebook title: Front End Engineer @ Facebook
url: https://github.com/yangshun url: https://github.com/yangshun
image_url: https://github.com/yangshun.png image_url: https://github.com/yangshun.png
page: true
socials: socials:
x: yangshunz x: yangshunz
github: yangshun github: yangshun
@ -18,6 +13,9 @@ slorber:
title: Docusaurus maintainer title: Docusaurus maintainer
url: https://sebastienlorber.com url: https://sebastienlorber.com
image_url: https://github.com/slorber.png image_url: https://github.com/slorber.png
page:
# customize the url of the author page at /blog/authors/<permalink>
permalink: '/all-sebastien-lorber-articles'
socials: socials:
x: sebastienlorber x: sebastienlorber
linkedin: sebastienlorber linkedin: sebastienlorber

View file

@ -2,14 +2,17 @@ facebook:
label: Facebook label: Facebook
permalink: /facebook permalink: /facebook
description: Facebook tag description description: Facebook tag description
hello: hello:
label: Hello label: Hello
permalink: /hello permalink: /hello
description: Hello tag description description: Hello tag description
docusaurus: docusaurus:
label: Docusaurus label: Docusaurus
permalink: /docusaurus permalink: /docusaurus
description: Docusaurus tag description description: Docusaurus tag description
hola: hola:
label: Hola label: Hola
permalink: /hola permalink: /hola

View file

@ -68,9 +68,9 @@ export const DEFAULT_OPTIONS: PluginOptions = {
showLastUpdateTime: false, showLastUpdateTime: false,
showLastUpdateAuthor: false, showLastUpdateAuthor: false,
processBlogPosts: async () => undefined, processBlogPosts: async () => undefined,
onInlineTags: 'warn',
tags: undefined, tags: undefined,
authorsBasePath: 'authors', authorsBasePath: 'authors',
onInlineTags: 'warn',
onInlineAuthors: 'warn', onInlineAuthors: 'warn',
onUntruncatedBlogPosts: 'warn', onUntruncatedBlogPosts: 'warn',
}; };

View file

@ -168,6 +168,7 @@ linkify
Linkify Linkify
Localizable Localizable
lockb lockb
lorber
Lorber Lorber
Lorber's Lorber's
lqip lqip