Skip to content

Commit 547979a

Browse files
authored
fix(create-docusaurus): Improve init templates blog setup + fix warnings (#10392)
1 parent 471f0d4 commit 547979a

File tree

10 files changed

+35
-17
lines changed

10 files changed

+35
-17
lines changed

packages/create-docusaurus/templates/classic-typescript/docusaurus.config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ const config: Config = {
5050
// Remove this to remove the "edit this page" links.
5151
editUrl:
5252
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
53+
// Useful options to enforce blogging best practices
54+
onInlineTags: 'warn',
55+
onInlineAuthors: 'warn',
56+
onUntruncatedBlogPosts: 'warn',
5357
},
5458
theme: {
5559
customCss: './src/css/custom.css',

packages/create-docusaurus/templates/classic/docusaurus.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ const config = {
5656
// Remove this to remove the "edit this page" links.
5757
editUrl:
5858
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
59+
// Useful options to enforce blogging best practices
60+
onInlineTags: 'warn',
61+
onInlineAuthors: 'warn',
62+
onUntruncatedBlogPosts: 'warn',
5963
},
6064
theme: {
6165
customCss: './src/css/custom.css',
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
slug: first-blog-post
33
title: First Blog Post
4-
authors:
5-
name: Gao Wei
6-
title: Docusaurus Core Team
7-
url: https://github.com/wgao19
8-
image_url: https://github.com/wgao19.png
4+
authors: [slorber, yangshun]
95
tags: [hola, docusaurus]
106
---
117

12-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
8+
Lorem ipsum dolor sit amet...
9+
10+
<!-- truncate -->
11+
12+
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

packages/create-docusaurus/templates/shared/blog/2019-05-29-long-blog-post.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
slug: long-blog-post
33
title: Long Blog Post
4-
authors: endi
4+
authors: yangshun
55
tags: [hello, docusaurus]
66
---
77

88
This is the summary of a very long blog post,
99

1010
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
1111

12-
<!--truncate-->
12+
<!-- truncate -->
1313

1414
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
1515

packages/create-docusaurus/templates/shared/blog/2021-08-01-mdx-blog-post.mdx

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/mar
1111

1212
Use the power of React to create interactive blog posts.
1313

14+
:::
15+
16+
{/* truncate */}
17+
18+
For example, use JSX to create an interactive button:
19+
1420
```js
1521
<button onClick={() => alert('button clicked!')}>Click me!</button>
1622
```
1723

1824
<button onClick={() => alert('button clicked!')}>Click me!</button>
19-
20-
:::

packages/create-docusaurus/templates/shared/blog/2021-08-26-welcome/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ tags: [facebook, hello, docusaurus]
77

88
[Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
99

10+
Here are a few tips you might find useful.
11+
12+
<!-- truncate -->
13+
1014
Simply add Markdown files (or folders) to the `blog` directory.
1115

1216
Regular blog authors can be added to `authors.yml`.

packages/create-docusaurus/templates/shared/blog/authors.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
endi:
2-
name: Endilie Yacop Sucipto
3-
title: Maintainer of Docusaurus
4-
url: https://github.com/endiliey
5-
image_url: https://github.com/endiliey.png
6-
71
yangshun:
82
name: Yangshun Tay
93
title: Front End Engineer @ Facebook
104
url: https://github.com/yangshun
115
image_url: https://github.com/yangshun.png
6+
page: true
127
socials:
138
x: yangshunz
149
github: yangshun
@@ -18,6 +13,9 @@ slorber:
1813
title: Docusaurus maintainer
1914
url: https://sebastienlorber.com
2015
image_url: https://github.com/slorber.png
16+
page:
17+
# customize the url of the author page at /blog/authors/<permalink>
18+
permalink: '/all-sebastien-lorber-articles'
2119
socials:
2220
x: sebastienlorber
2321
linkedin: sebastienlorber

packages/create-docusaurus/templates/shared/blog/tags.yml

+3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ facebook:
22
label: Facebook
33
permalink: /facebook
44
description: Facebook tag description
5+
56
hello:
67
label: Hello
78
permalink: /hello
89
description: Hello tag description
10+
911
docusaurus:
1012
label: Docusaurus
1113
permalink: /docusaurus
1214
description: Docusaurus tag description
15+
1316
hola:
1417
label: Hola
1518
permalink: /hola

packages/docusaurus-plugin-content-blog/src/options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ export const DEFAULT_OPTIONS: PluginOptions = {
6868
showLastUpdateTime: false,
6969
showLastUpdateAuthor: false,
7070
processBlogPosts: async () => undefined,
71-
onInlineTags: 'warn',
7271
tags: undefined,
7372
authorsBasePath: 'authors',
73+
onInlineTags: 'warn',
7474
onInlineAuthors: 'warn',
7575
onUntruncatedBlogPosts: 'warn',
7676
};

project-words.txt

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ linkify
168168
Linkify
169169
Localizable
170170
lockb
171+
lorber
171172
Lorber
172173
Lorber's
173174
lqip

0 commit comments

Comments
 (0)