@docusaurus/theme-classic 2.4.1 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/theme/BlogPostItem/Container/index.js +11 -2
- package/lib/theme/BlogPostItem/Header/Author/index.js +6 -1
- package/lib/theme/DocPage/Layout/styles.module.css +8 -0
- package/lib/theme/MDXComponents/Ul/index.js +4 -0
- package/lib/theme/SiteMetadata/index.js +9 -2
- package/package.json +14 -14
- package/src/theme/BlogPostItem/Container/index.tsx +11 -2
- package/src/theme/BlogPostItem/Header/Author/index.tsx +6 -1
- package/src/theme/DocPage/Layout/styles.module.css +8 -0
- package/src/theme/MDXComponents/Ul/index.tsx +5 -1
- package/src/theme/SiteMetadata/index.tsx +12 -2
|
@@ -8,17 +8,26 @@ import React from 'react';
|
|
|
8
8
|
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
9
9
|
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
10
10
|
export default function BlogPostItemContainer({children, className}) {
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
frontMatter,
|
|
13
|
+
assets,
|
|
14
|
+
metadata: {description},
|
|
15
|
+
} = useBlogPost();
|
|
12
16
|
const {withBaseUrl} = useBaseUrlUtils();
|
|
13
17
|
const image = assets.image ?? frontMatter.image;
|
|
18
|
+
const keywords = frontMatter.keywords ?? [];
|
|
14
19
|
return (
|
|
15
20
|
<article
|
|
16
21
|
className={className}
|
|
17
22
|
itemProp="blogPost"
|
|
18
23
|
itemScope
|
|
19
24
|
itemType="http://schema.org/BlogPosting">
|
|
25
|
+
{description && <meta itemProp="description" content={description} />}
|
|
20
26
|
{image && (
|
|
21
|
-
<
|
|
27
|
+
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
|
|
28
|
+
)}
|
|
29
|
+
{keywords.length > 0 && (
|
|
30
|
+
<meta itemProp="keywords" content={keywords.join(',')} />
|
|
22
31
|
)}
|
|
23
32
|
{children}
|
|
24
33
|
</article>
|
|
@@ -20,7 +20,12 @@ export default function BlogPostItemHeaderAuthor({author, className}) {
|
|
|
20
20
|
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
21
21
|
{imageURL && (
|
|
22
22
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
23
|
-
<img
|
|
23
|
+
<img
|
|
24
|
+
className="avatar__photo"
|
|
25
|
+
src={imageURL}
|
|
26
|
+
alt={name}
|
|
27
|
+
itemProp="image"
|
|
28
|
+
/>
|
|
24
29
|
</MaybeLink>
|
|
25
30
|
)}
|
|
26
31
|
|
|
@@ -15,3 +15,11 @@
|
|
|
15
15
|
display: flex;
|
|
16
16
|
flex: 1 0 auto;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
JS disabled??? Show light version by default => better than showing nothing
|
|
21
|
+
TODO bad, but we currently always show light mode when there's no data-theme
|
|
22
|
+
*/
|
|
23
|
+
html:not([data-theme]) .themedComponent--light {
|
|
24
|
+
display: initial;
|
|
25
|
+
}
|
|
@@ -8,6 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
10
|
function transformUlClassName(className) {
|
|
11
|
+
// Fix https://github.com/facebook/docusaurus/issues/9098
|
|
12
|
+
if (typeof className === 'undefined') {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
11
15
|
return clsx(
|
|
12
16
|
className,
|
|
13
17
|
// This class is set globally by GitHub/MDX. We keep the global class, and
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
keyboardFocusedClassName,
|
|
16
16
|
} from '@docusaurus/theme-common/internal';
|
|
17
17
|
import {useLocation} from '@docusaurus/router';
|
|
18
|
+
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
|
18
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
19
20
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
20
21
|
// Useful for i18n/SEO
|
|
@@ -54,10 +55,16 @@ function AlternateLangHeaders() {
|
|
|
54
55
|
// Default canonical url inferred from current page location pathname
|
|
55
56
|
function useDefaultCanonicalUrl() {
|
|
56
57
|
const {
|
|
57
|
-
siteConfig: {url: siteUrl},
|
|
58
|
+
siteConfig: {url: siteUrl, baseUrl, trailingSlash},
|
|
58
59
|
} = useDocusaurusContext();
|
|
60
|
+
// TODO using useLocation().pathname is not a super idea
|
|
61
|
+
// See https://github.com/facebook/docusaurus/issues/9170
|
|
59
62
|
const {pathname} = useLocation();
|
|
60
|
-
|
|
63
|
+
const canonicalPathname = applyTrailingSlash(useBaseUrl(pathname), {
|
|
64
|
+
trailingSlash,
|
|
65
|
+
baseUrl,
|
|
66
|
+
});
|
|
67
|
+
return siteUrl + canonicalPathname;
|
|
61
68
|
}
|
|
62
69
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
63
70
|
function CanonicalUrlHeaders({permalink}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "2.4.
|
|
24
|
-
"@docusaurus/mdx-loader": "2.4.
|
|
25
|
-
"@docusaurus/module-type-aliases": "2.4.
|
|
26
|
-
"@docusaurus/plugin-content-blog": "2.4.
|
|
27
|
-
"@docusaurus/plugin-content-docs": "2.4.
|
|
28
|
-
"@docusaurus/plugin-content-pages": "2.4.
|
|
29
|
-
"@docusaurus/theme-common": "2.4.
|
|
30
|
-
"@docusaurus/theme-translations": "2.4.
|
|
31
|
-
"@docusaurus/types": "2.4.
|
|
32
|
-
"@docusaurus/utils": "2.4.
|
|
33
|
-
"@docusaurus/utils-common": "2.4.
|
|
34
|
-
"@docusaurus/utils-validation": "2.4.
|
|
23
|
+
"@docusaurus/core": "2.4.3",
|
|
24
|
+
"@docusaurus/mdx-loader": "2.4.3",
|
|
25
|
+
"@docusaurus/module-type-aliases": "2.4.3",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "2.4.3",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "2.4.3",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "2.4.3",
|
|
29
|
+
"@docusaurus/theme-common": "2.4.3",
|
|
30
|
+
"@docusaurus/theme-translations": "2.4.3",
|
|
31
|
+
"@docusaurus/types": "2.4.3",
|
|
32
|
+
"@docusaurus/utils": "2.4.3",
|
|
33
|
+
"@docusaurus/utils-common": "2.4.3",
|
|
34
|
+
"@docusaurus/utils-validation": "2.4.3",
|
|
35
35
|
"@mdx-js/react": "^1.6.22",
|
|
36
36
|
"clsx": "^1.2.1",
|
|
37
37
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=16.14"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "56410aa94665699f75cb889f477ccdffb98f2b21"
|
|
66
66
|
}
|
|
@@ -14,17 +14,26 @@ export default function BlogPostItemContainer({
|
|
|
14
14
|
children,
|
|
15
15
|
className,
|
|
16
16
|
}: Props): JSX.Element {
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
frontMatter,
|
|
19
|
+
assets,
|
|
20
|
+
metadata: {description},
|
|
21
|
+
} = useBlogPost();
|
|
18
22
|
const {withBaseUrl} = useBaseUrlUtils();
|
|
19
23
|
const image = assets.image ?? frontMatter.image;
|
|
24
|
+
const keywords = frontMatter.keywords ?? [];
|
|
20
25
|
return (
|
|
21
26
|
<article
|
|
22
27
|
className={className}
|
|
23
28
|
itemProp="blogPost"
|
|
24
29
|
itemScope
|
|
25
30
|
itemType="http://schema.org/BlogPosting">
|
|
31
|
+
{description && <meta itemProp="description" content={description} />}
|
|
26
32
|
{image && (
|
|
27
|
-
<
|
|
33
|
+
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
|
|
34
|
+
)}
|
|
35
|
+
{keywords.length > 0 && (
|
|
36
|
+
<meta itemProp="keywords" content={keywords.join(',')} />
|
|
28
37
|
)}
|
|
29
38
|
{children}
|
|
30
39
|
</article>
|
|
@@ -28,7 +28,12 @@ export default function BlogPostItemHeaderAuthor({
|
|
|
28
28
|
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
29
29
|
{imageURL && (
|
|
30
30
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
31
|
-
<img
|
|
31
|
+
<img
|
|
32
|
+
className="avatar__photo"
|
|
33
|
+
src={imageURL}
|
|
34
|
+
alt={name}
|
|
35
|
+
itemProp="image"
|
|
36
|
+
/>
|
|
32
37
|
</MaybeLink>
|
|
33
38
|
)}
|
|
34
39
|
|
|
@@ -15,3 +15,11 @@
|
|
|
15
15
|
display: flex;
|
|
16
16
|
flex: 1 0 auto;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
JS disabled??? Show light version by default => better than showing nothing
|
|
21
|
+
TODO bad, but we currently always show light mode when there's no data-theme
|
|
22
|
+
*/
|
|
23
|
+
html:not([data-theme]) .themedComponent--light {
|
|
24
|
+
display: initial;
|
|
25
|
+
}
|
|
@@ -11,7 +11,11 @@ import type {Props} from '@theme/MDXComponents/Ul';
|
|
|
11
11
|
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
|
|
14
|
-
function transformUlClassName(className?: string): string {
|
|
14
|
+
function transformUlClassName(className?: string): string | undefined {
|
|
15
|
+
// Fix https://github.com/facebook/docusaurus/issues/9098
|
|
16
|
+
if (typeof className === 'undefined') {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
15
19
|
return clsx(
|
|
16
20
|
className,
|
|
17
21
|
// This class is set globally by GitHub/MDX. We keep the global class, and
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
keyboardFocusedClassName,
|
|
17
17
|
} from '@docusaurus/theme-common/internal';
|
|
18
18
|
import {useLocation} from '@docusaurus/router';
|
|
19
|
+
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
|
19
20
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
21
|
|
|
21
22
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
@@ -58,10 +59,19 @@ function AlternateLangHeaders(): JSX.Element {
|
|
|
58
59
|
// Default canonical url inferred from current page location pathname
|
|
59
60
|
function useDefaultCanonicalUrl() {
|
|
60
61
|
const {
|
|
61
|
-
siteConfig: {url: siteUrl},
|
|
62
|
+
siteConfig: {url: siteUrl, baseUrl, trailingSlash},
|
|
62
63
|
} = useDocusaurusContext();
|
|
64
|
+
|
|
65
|
+
// TODO using useLocation().pathname is not a super idea
|
|
66
|
+
// See https://github.com/facebook/docusaurus/issues/9170
|
|
63
67
|
const {pathname} = useLocation();
|
|
64
|
-
|
|
68
|
+
|
|
69
|
+
const canonicalPathname = applyTrailingSlash(useBaseUrl(pathname), {
|
|
70
|
+
trailingSlash,
|
|
71
|
+
baseUrl,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return siteUrl + canonicalPathname;
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
// TODO move to SiteMetadataDefaults or theme-common ?
|