@docusaurus/theme-common 0.0.0-5994 → 0.0.0-6000
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/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/internal.d.ts +0 -2
- package/lib/internal.d.ts.map +1 -1
- package/lib/internal.js +0 -2
- package/lib/internal.js.map +1 -1
- package/package.json +10 -11
- package/src/index.ts +0 -5
- package/src/internal.ts +0 -10
- package/src/types.d.ts +0 -2
- package/lib/contexts/blogPost.d.ts +0 -33
- package/lib/contexts/blogPost.d.ts.map +0 -1
- package/lib/contexts/blogPost.js +0 -46
- package/lib/contexts/blogPost.js.map +0 -1
- package/lib/utils/blogUtils.d.ts +0 -22
- package/lib/utils/blogUtils.d.ts.map +0 -1
- package/lib/utils/blogUtils.js +0 -50
- package/lib/utils/blogUtils.js.map +0 -1
- package/lib/utils/structuredDataUtils.d.ts +0 -11
- package/lib/utils/structuredDataUtils.d.ts.map +0 -1
- package/lib/utils/structuredDataUtils.js +0 -123
- package/lib/utils/structuredDataUtils.js.map +0 -1
- package/src/contexts/blogPost.tsx +0 -80
- package/src/utils/blogUtils.tsx +0 -85
- package/src/utils/structuredDataUtils.ts +0 -177
package/lib/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export { default as ThemedComponent } from './components/ThemedComponent';
|
|
|
9
9
|
export { createStorageSlot, useStorageSlot, listStorageKeys, } from './utils/storageUtils';
|
|
10
10
|
export { useContextualSearchFilters } from './utils/searchUtils';
|
|
11
11
|
export { useCurrentSidebarCategory, filterDocCardListItems, } from './utils/docsUtils';
|
|
12
|
-
export { useBlogListPageStructuredData, useBlogPostStructuredData, } from './utils/structuredDataUtils';
|
|
13
12
|
export { usePluralForm } from './utils/usePluralForm';
|
|
14
13
|
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
15
14
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GAC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,4BAA4B,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,4BAA4B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -12,7 +12,6 @@ export { default as ThemedComponent } from './components/ThemedComponent';
|
|
|
12
12
|
export { createStorageSlot, useStorageSlot, listStorageKeys, } from './utils/storageUtils';
|
|
13
13
|
export { useContextualSearchFilters } from './utils/searchUtils';
|
|
14
14
|
export { useCurrentSidebarCategory, filterDocCardListItems, } from './utils/docsUtils';
|
|
15
|
-
export { useBlogListPageStructuredData, useBlogPostStructuredData, } from './utils/structuredDataUtils';
|
|
16
15
|
export { usePluralForm } from './utils/usePluralForm';
|
|
17
16
|
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
18
17
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EACL,cAAc,GAYf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EACL,cAAc,GAYf,MAAM,wBAAwB,CAAC;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AExE,OAAO,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,4BAA4B,CAAC"}
|
package/lib/internal.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState,
|
|
|
9
9
|
export { DocsVersionProvider, useDocsVersion } from './contexts/docsVersion';
|
|
10
10
|
export { DocsSidebarProvider, useDocsSidebar } from './contexts/docsSidebar';
|
|
11
11
|
export { DocProvider, useDoc, type DocContextValue } from './contexts/doc';
|
|
12
|
-
export { BlogPostProvider, useBlogPost, type BlogPostContextValue, } from './contexts/blogPost';
|
|
13
12
|
export { useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
14
13
|
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
15
14
|
export { useTabs, sanitizeTabsChildren } from './utils/tabsUtils';
|
|
@@ -31,7 +30,6 @@ export { useHomePageRoute, isSamePath } from './utils/routesUtils';
|
|
|
31
30
|
export { PluginHtmlClassNameProvider } from './utils/metadataUtils';
|
|
32
31
|
export { splitNavbarItems, NavbarProvider } from './utils/navbarUtils';
|
|
33
32
|
export { useTOCHighlight, type TOCHighlightConfig, } from './hooks/useTOCHighlight';
|
|
34
|
-
export { useVisibleBlogSidebarItems, groupBlogSidebarItemsByYear, BlogSidebarItemList, } from './utils/blogUtils';
|
|
35
33
|
export { useDateTimeFormat } from './utils/IntlUtils';
|
|
36
34
|
export { useHideableNavbar } from './hooks/useHideableNavbar';
|
|
37
35
|
export { useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
package/lib/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,eAAe,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAC,WAAW,EAAE,MAAM,EAAE,KAAK,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EACL,iCAAiC,EACjC,mCAAmC,GACpC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAChE,YAAY,EAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAEzE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AAkB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC"}
|
package/lib/internal.js
CHANGED
|
@@ -20,7 +20,6 @@ export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState,
|
|
|
20
20
|
export { DocsVersionProvider, useDocsVersion } from './contexts/docsVersion';
|
|
21
21
|
export { DocsSidebarProvider, useDocsSidebar } from './contexts/docsSidebar';
|
|
22
22
|
export { DocProvider, useDoc } from './contexts/doc';
|
|
23
|
-
export { BlogPostProvider, useBlogPost, } from './contexts/blogPost';
|
|
24
23
|
export { useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
25
24
|
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
26
25
|
export { useTabs, sanitizeTabsChildren } from './utils/tabsUtils';
|
|
@@ -41,7 +40,6 @@ export { useHomePageRoute, isSamePath } from './utils/routesUtils';
|
|
|
41
40
|
export { PluginHtmlClassNameProvider } from './utils/metadataUtils';
|
|
42
41
|
export { splitNavbarItems, NavbarProvider } from './utils/navbarUtils';
|
|
43
42
|
export { useTOCHighlight, } from './hooks/useTOCHighlight';
|
|
44
|
-
export { useVisibleBlogSidebarItems, groupBlogSidebarItemsByYear, BlogSidebarItemList, } from './utils/blogUtils';
|
|
45
43
|
export { useDateTimeFormat } from './utils/IntlUtils';
|
|
46
44
|
export { useHideableNavbar } from './hooks/useHideableNavbar';
|
|
47
45
|
export { useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
package/lib/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,uDAAuD;AACvD,EAAE;AACF,6DAA6D;AAC7D,gFAAgF;AAChF,yEAAyE;AACzE,oDAAoD;AACpD,EAAE;AACF,gDAAgD;AAChD,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAC,WAAW,EAAE,MAAM,EAAuB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,uDAAuD;AACvD,EAAE;AACF,6DAA6D;AAC7D,gFAAgF;AAChF,yEAAyE;AACzE,oDAAoD;AACpD,EAAE;AACF,gDAAgD;AAChD,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAC,WAAW,EAAE,MAAM,EAAuB,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EACL,iCAAiC,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qB,CAAC;AAEjE,OAAO,EAAC,2BAA2B,EAAC,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAErE,OAAO,EACL,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-common",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-6000",
|
|
4
4
|
"description": "Common code for Docusaurus themes.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -30,13 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
34
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
35
|
-
"@docusaurus/plugin-content-
|
|
36
|
-
"@docusaurus/plugin-content-
|
|
37
|
-
"@docusaurus/
|
|
38
|
-
"@docusaurus/utils": "0.0.0-
|
|
39
|
-
"@docusaurus/utils-common": "0.0.0-5994",
|
|
33
|
+
"@docusaurus/mdx-loader": "0.0.0-6000",
|
|
34
|
+
"@docusaurus/module-type-aliases": "0.0.0-6000",
|
|
35
|
+
"@docusaurus/plugin-content-docs": "0.0.0-6000",
|
|
36
|
+
"@docusaurus/plugin-content-pages": "0.0.0-6000",
|
|
37
|
+
"@docusaurus/utils": "0.0.0-6000",
|
|
38
|
+
"@docusaurus/utils-common": "0.0.0-6000",
|
|
40
39
|
"@types/history": "^4.7.11",
|
|
41
40
|
"@types/react": "*",
|
|
42
41
|
"@types/react-router-config": "*",
|
|
@@ -47,8 +46,8 @@
|
|
|
47
46
|
"utility-types": "^3.10.0"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@docusaurus/core": "0.0.0-
|
|
51
|
-
"@docusaurus/types": "0.0.0-
|
|
49
|
+
"@docusaurus/core": "0.0.0-6000",
|
|
50
|
+
"@docusaurus/types": "0.0.0-6000",
|
|
52
51
|
"fs-extra": "^11.1.1",
|
|
53
52
|
"lodash": "^4.17.21",
|
|
54
53
|
"schema-dts": "^1.1.2"
|
|
@@ -60,5 +59,5 @@
|
|
|
60
59
|
"engines": {
|
|
61
60
|
"node": ">=18.0"
|
|
62
61
|
},
|
|
63
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "10f44ae468ae6751fa53eb8af6441265f0e5075c"
|
|
64
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -39,11 +39,6 @@ export {
|
|
|
39
39
|
filterDocCardListItems,
|
|
40
40
|
} from './utils/docsUtils';
|
|
41
41
|
|
|
42
|
-
export {
|
|
43
|
-
useBlogListPageStructuredData,
|
|
44
|
-
useBlogPostStructuredData,
|
|
45
|
-
} from './utils/structuredDataUtils';
|
|
46
|
-
|
|
47
42
|
export {usePluralForm} from './utils/usePluralForm';
|
|
48
43
|
|
|
49
44
|
export {useCollapsible, Collapsible} from './components/Collapsible';
|
package/src/internal.ts
CHANGED
|
@@ -26,11 +26,6 @@ export {DocsVersionProvider, useDocsVersion} from './contexts/docsVersion';
|
|
|
26
26
|
export {DocsSidebarProvider, useDocsSidebar} from './contexts/docsSidebar';
|
|
27
27
|
|
|
28
28
|
export {DocProvider, useDoc, type DocContextValue} from './contexts/doc';
|
|
29
|
-
export {
|
|
30
|
-
BlogPostProvider,
|
|
31
|
-
useBlogPost,
|
|
32
|
-
type BlogPostContextValue,
|
|
33
|
-
} from './contexts/blogPost';
|
|
34
29
|
|
|
35
30
|
export {
|
|
36
31
|
useDocsPreferredVersionByPluginId,
|
|
@@ -113,11 +108,6 @@ export {
|
|
|
113
108
|
type TOCHighlightConfig,
|
|
114
109
|
} from './hooks/useTOCHighlight';
|
|
115
110
|
|
|
116
|
-
export {
|
|
117
|
-
useVisibleBlogSidebarItems,
|
|
118
|
-
groupBlogSidebarItemsByYear,
|
|
119
|
-
BlogSidebarItemList,
|
|
120
|
-
} from './utils/blogUtils';
|
|
121
111
|
export {useDateTimeFormat} from './utils/IntlUtils';
|
|
122
112
|
|
|
123
113
|
export {useHideableNavbar} from './hooks/useHideableNavbar';
|
package/src/types.d.ts
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { type ReactNode } from 'react';
|
|
8
|
-
import type { PropBlogPostContent } from '@docusaurus/plugin-content-blog';
|
|
9
|
-
/**
|
|
10
|
-
* The React context value returned by the `useBlogPost()` hook.
|
|
11
|
-
* It contains useful data related to the currently browsed blog post.
|
|
12
|
-
*/
|
|
13
|
-
export type BlogPostContextValue = Pick<PropBlogPostContent, 'metadata' | 'frontMatter' | 'assets' | 'toc'> & {
|
|
14
|
-
readonly isBlogPostPage: boolean;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* This is a very thin layer around the `content` received from the MDX loader.
|
|
18
|
-
* It provides metadata about the blog post to the children tree.
|
|
19
|
-
*/
|
|
20
|
-
export declare function BlogPostProvider({ children, content, isBlogPostPage, }: {
|
|
21
|
-
children: ReactNode;
|
|
22
|
-
content: PropBlogPostContent;
|
|
23
|
-
isBlogPostPage?: boolean;
|
|
24
|
-
}): JSX.Element;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the data of the currently browsed blog post. Gives access to
|
|
27
|
-
* front matter, metadata, TOC, etc.
|
|
28
|
-
* When swizzling a low-level component (e.g. the "Edit this page" link)
|
|
29
|
-
* and you need some extra metadata, you don't have to drill the props
|
|
30
|
-
* all the way through the component tree: simply use this hook instead.
|
|
31
|
-
*/
|
|
32
|
-
export declare function useBlogPost(): BlogPostContextValue;
|
|
33
|
-
//# sourceMappingURL=blogPost.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blogPost.d.ts","sourceRoot":"","sources":["../../src/contexts/blogPost.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAU,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,mBAAmB,EACnB,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,KAAK,CAC9C,GAAG;IACF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC,CAAC;AA4BF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,cAAsB,GACvB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,GAAG,CAAC,OAAO,CAGd;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,oBAAoB,CAMlD"}
|
package/lib/contexts/blogPost.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import React, { useMemo, useContext } from 'react';
|
|
8
|
-
import { ReactContextError } from '../utils/reactUtils';
|
|
9
|
-
const Context = React.createContext(null);
|
|
10
|
-
/**
|
|
11
|
-
* Note: we don't use `PropBlogPostContent` as context value on purpose.
|
|
12
|
-
* Metadata is currently stored inside the MDX component, but we may want to
|
|
13
|
-
* change that in the future.
|
|
14
|
-
*/
|
|
15
|
-
function useContextValue({ content, isBlogPostPage, }) {
|
|
16
|
-
return useMemo(() => ({
|
|
17
|
-
metadata: content.metadata,
|
|
18
|
-
frontMatter: content.frontMatter,
|
|
19
|
-
assets: content.assets,
|
|
20
|
-
toc: content.toc,
|
|
21
|
-
isBlogPostPage,
|
|
22
|
-
}), [content, isBlogPostPage]);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* This is a very thin layer around the `content` received from the MDX loader.
|
|
26
|
-
* It provides metadata about the blog post to the children tree.
|
|
27
|
-
*/
|
|
28
|
-
export function BlogPostProvider({ children, content, isBlogPostPage = false, }) {
|
|
29
|
-
const contextValue = useContextValue({ content, isBlogPostPage });
|
|
30
|
-
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Returns the data of the currently browsed blog post. Gives access to
|
|
34
|
-
* front matter, metadata, TOC, etc.
|
|
35
|
-
* When swizzling a low-level component (e.g. the "Edit this page" link)
|
|
36
|
-
* and you need some extra metadata, you don't have to drill the props
|
|
37
|
-
* all the way through the component tree: simply use this hook instead.
|
|
38
|
-
*/
|
|
39
|
-
export function useBlogPost() {
|
|
40
|
-
const blogPost = useContext(Context);
|
|
41
|
-
if (blogPost === null) {
|
|
42
|
-
throw new ReactContextError('BlogPostProvider');
|
|
43
|
-
}
|
|
44
|
-
return blogPost;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL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B,CAAC"}
|
package/lib/utils/blogUtils.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { type ReactNode } from 'react';
|
|
8
|
-
import type { BlogSidebarItem } from '@docusaurus/plugin-content-blog';
|
|
9
|
-
/**
|
|
10
|
-
* Return the visible blog sidebar items to display.
|
|
11
|
-
* Unlisted items are filtered.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useVisibleBlogSidebarItems(items: BlogSidebarItem[]): BlogSidebarItem[];
|
|
14
|
-
export declare function groupBlogSidebarItemsByYear(items: BlogSidebarItem[]): [string, BlogSidebarItem[]][];
|
|
15
|
-
export declare function BlogSidebarItemList({ items, ulClassName, liClassName, linkClassName, linkActiveClassName, }: {
|
|
16
|
-
items: BlogSidebarItem[];
|
|
17
|
-
ulClassName?: string;
|
|
18
|
-
liClassName?: string;
|
|
19
|
-
linkClassName?: string;
|
|
20
|
-
linkActiveClassName?: string;
|
|
21
|
-
}): ReactNode;
|
|
22
|
-
//# sourceMappingURL=blogUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blogUtils.d.ts","sourceRoot":"","sources":["../../src/utils/blogUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAKrD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AASrE;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,EAAE,GACvB,eAAe,EAAE,CAMnB;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,eAAe,EAAE,GACvB,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,EAAE,CAiB/B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,mBAAmB,GACpB,EAAE;IACD,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,GAAG,SAAS,CAgBZ"}
|
package/lib/utils/blogUtils.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import React, { useMemo } from 'react';
|
|
8
|
-
import { useLocation } from '@docusaurus/router';
|
|
9
|
-
import Link from '@docusaurus/Link';
|
|
10
|
-
import { isSamePath } from './routesUtils';
|
|
11
|
-
import { groupBy } from './jsUtils';
|
|
12
|
-
function isVisible(item, pathname) {
|
|
13
|
-
if (item.unlisted && !isSamePath(item.permalink, pathname)) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Return the visible blog sidebar items to display.
|
|
20
|
-
* Unlisted items are filtered.
|
|
21
|
-
*/
|
|
22
|
-
export function useVisibleBlogSidebarItems(items) {
|
|
23
|
-
const { pathname } = useLocation();
|
|
24
|
-
return useMemo(() => items.filter((item) => isVisible(item, pathname)), [items, pathname]);
|
|
25
|
-
}
|
|
26
|
-
export function groupBlogSidebarItemsByYear(items) {
|
|
27
|
-
const groupedByYear = groupBy(items, (item) => {
|
|
28
|
-
return `${new Date(item.date).getFullYear()}`;
|
|
29
|
-
});
|
|
30
|
-
// "as" is safe here
|
|
31
|
-
// see https://github.com/microsoft/TypeScript/pull/56805#issuecomment-2196526425
|
|
32
|
-
const entries = Object.entries(groupedByYear);
|
|
33
|
-
// We have to use entries because of https://x.com/sebastienlorber/status/1806371668614369486
|
|
34
|
-
// Objects with string/number keys are automatically sorted asc...
|
|
35
|
-
// Even if keys are strings like "2024"
|
|
36
|
-
// We want descending order for years
|
|
37
|
-
// Alternative: using Map.groupBy (not affected by this "reordering")
|
|
38
|
-
entries.reverse();
|
|
39
|
-
return entries;
|
|
40
|
-
}
|
|
41
|
-
export function BlogSidebarItemList({ items, ulClassName, liClassName, linkClassName, linkActiveClassName, }) {
|
|
42
|
-
return (<ul className={ulClassName}>
|
|
43
|
-
{items.map((item) => (<li key={item.permalink} className={liClassName}>
|
|
44
|
-
<Link isNavLink to={item.permalink} className={linkClassName} activeClassName={linkActiveClassName}>
|
|
45
|
-
{item.title}
|
|
46
|
-
</Link>
|
|
47
|
-
</li>))}
|
|
48
|
-
</ul>);
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=blogUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blogUtils.js","sourceRoot":"","sources":["../../src/utils/blogUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAiB,OAAO,EAAC,MAAM,OAAO,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAGlC,SAAS,SAAS,CAAC,IAAqB,EAAE,QAAgB;IACxD,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;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,CAAC,mBAAmB,CAAC,CACrC;YAAA,CAAC,IAAI,CAAC,KAAK,CACb;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,EAAE,CAAC,CACN,CAAC,CACJ;IAAA,EAAE,EAAE,CAAC,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import type { Props as BlogListPageStructuredDataProps } from '@theme/BlogListPage/StructuredData';
|
|
8
|
-
import type { Blog, BlogPosting, WithContext } from 'schema-dts';
|
|
9
|
-
export declare function useBlogListPageStructuredData(props: BlogListPageStructuredDataProps): WithContext<Blog>;
|
|
10
|
-
export declare function useBlogPostStructuredData(): WithContext<BlogPosting>;
|
|
11
|
-
//# sourceMappingURL=structuredDataUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"structuredDataUtils.d.ts","sourceRoot":"","sources":["../../src/utils/structuredDataUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAC,KAAK,IAAI,+BAA+B,EAAC,MAAM,oCAAoC,CAAC;AAEjG,OAAO,KAAK,EACV,IAAI,EACJ,WAAW,EACX,WAAW,EAGZ,MAAM,YAAY,CAAC;AAiEpB,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,+BAA+B,GACrC,WAAW,CAAC,IAAI,CAAC,CAsBnB;AAED,wBAAgB,yBAAyB,IAAI,WAAW,CAAC,WAAW,CAAC,CAsCpE"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { useBaseUrlUtils } from '@docusaurus/useBaseUrl';
|
|
8
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
9
|
-
import { useBlogMetadata } from '@docusaurus/plugin-content-blog/client';
|
|
10
|
-
import { useBlogPost } from '../contexts/blogPost';
|
|
11
|
-
const convertDate = (dateMs) => new Date(dateMs).toISOString();
|
|
12
|
-
function getBlogPost(blogPostContent, siteConfig, withBaseUrl) {
|
|
13
|
-
const { assets, frontMatter, metadata } = blogPostContent;
|
|
14
|
-
const { date, title, description, lastUpdatedAt } = metadata;
|
|
15
|
-
const image = assets.image ?? frontMatter.image;
|
|
16
|
-
const keywords = frontMatter.keywords ?? [];
|
|
17
|
-
const blogUrl = `${siteConfig.url}${metadata.permalink}`;
|
|
18
|
-
const dateModified = lastUpdatedAt ? convertDate(lastUpdatedAt) : undefined;
|
|
19
|
-
return {
|
|
20
|
-
'@type': 'BlogPosting',
|
|
21
|
-
'@id': blogUrl,
|
|
22
|
-
mainEntityOfPage: blogUrl,
|
|
23
|
-
url: blogUrl,
|
|
24
|
-
headline: title,
|
|
25
|
-
name: title,
|
|
26
|
-
description,
|
|
27
|
-
datePublished: date,
|
|
28
|
-
...(dateModified ? { dateModified } : {}),
|
|
29
|
-
...getAuthor(metadata.authors),
|
|
30
|
-
...getImage(image, withBaseUrl, title),
|
|
31
|
-
...(keywords ? { keywords } : {}),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function getAuthor(authors) {
|
|
35
|
-
const authorsStructuredData = authors.map(createPersonStructuredData);
|
|
36
|
-
return {
|
|
37
|
-
author: authorsStructuredData.length === 1
|
|
38
|
-
? authorsStructuredData[0]
|
|
39
|
-
: authorsStructuredData,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function getImage(image, withBaseUrl, title) {
|
|
43
|
-
return image
|
|
44
|
-
? {
|
|
45
|
-
image: createImageStructuredData({
|
|
46
|
-
imageUrl: withBaseUrl(image, { absolute: true }),
|
|
47
|
-
caption: `title image for the blog post: ${title}`,
|
|
48
|
-
}),
|
|
49
|
-
}
|
|
50
|
-
: {};
|
|
51
|
-
}
|
|
52
|
-
export function useBlogListPageStructuredData(props) {
|
|
53
|
-
const { siteConfig } = useDocusaurusContext();
|
|
54
|
-
const { withBaseUrl } = useBaseUrlUtils();
|
|
55
|
-
const { metadata: { blogDescription, blogTitle, permalink }, } = props;
|
|
56
|
-
const url = `${siteConfig.url}${permalink}`;
|
|
57
|
-
// details on structured data support: https://schema.org/Blog
|
|
58
|
-
return {
|
|
59
|
-
'@context': 'https://schema.org',
|
|
60
|
-
'@type': 'Blog',
|
|
61
|
-
'@id': url,
|
|
62
|
-
mainEntityOfPage: url,
|
|
63
|
-
headline: blogTitle,
|
|
64
|
-
description: blogDescription,
|
|
65
|
-
blogPost: props.items.map((blogItem) => getBlogPost(blogItem.content, siteConfig, withBaseUrl)),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export function useBlogPostStructuredData() {
|
|
69
|
-
const blogMetadata = useBlogMetadata();
|
|
70
|
-
const { assets, metadata } = useBlogPost();
|
|
71
|
-
const { siteConfig } = useDocusaurusContext();
|
|
72
|
-
const { withBaseUrl } = useBaseUrlUtils();
|
|
73
|
-
const { date, title, description, frontMatter, lastUpdatedAt } = metadata;
|
|
74
|
-
const image = assets.image ?? frontMatter.image;
|
|
75
|
-
const keywords = frontMatter.keywords ?? [];
|
|
76
|
-
const dateModified = lastUpdatedAt ? convertDate(lastUpdatedAt) : undefined;
|
|
77
|
-
const url = `${siteConfig.url}${metadata.permalink}`;
|
|
78
|
-
// details on structured data support: https://schema.org/BlogPosting
|
|
79
|
-
// BlogPosting is one of the structured data types that Google explicitly
|
|
80
|
-
// supports: https://developers.google.com/search/docs/appearance/structured-data/article#structured-data-type-definitions
|
|
81
|
-
return {
|
|
82
|
-
'@context': 'https://schema.org',
|
|
83
|
-
'@type': 'BlogPosting',
|
|
84
|
-
'@id': url,
|
|
85
|
-
mainEntityOfPage: url,
|
|
86
|
-
url,
|
|
87
|
-
headline: title,
|
|
88
|
-
name: title,
|
|
89
|
-
description,
|
|
90
|
-
datePublished: date,
|
|
91
|
-
...(dateModified ? { dateModified } : {}),
|
|
92
|
-
...getAuthor(metadata.authors),
|
|
93
|
-
...getImage(image, withBaseUrl, title),
|
|
94
|
-
...(keywords ? { keywords } : {}),
|
|
95
|
-
isPartOf: {
|
|
96
|
-
'@type': 'Blog',
|
|
97
|
-
'@id': `${siteConfig.url}${blogMetadata.blogBasePath}`,
|
|
98
|
-
name: blogMetadata.blogTitle,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/** @returns A {@link https://schema.org/Person} constructed from the {@link Author} */
|
|
103
|
-
function createPersonStructuredData(author) {
|
|
104
|
-
return {
|
|
105
|
-
'@type': 'Person',
|
|
106
|
-
...(author.name ? { name: author.name } : {}),
|
|
107
|
-
...(author.title ? { description: author.title } : {}),
|
|
108
|
-
...(author.url ? { url: author.url } : {}),
|
|
109
|
-
...(author.email ? { email: author.email } : {}),
|
|
110
|
-
...(author.imageURL ? { image: author.imageURL } : {}),
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/** @returns A {@link https://schema.org/ImageObject} */
|
|
114
|
-
function createImageStructuredData({ imageUrl, caption, }) {
|
|
115
|
-
return {
|
|
116
|
-
'@type': 'ImageObject',
|
|
117
|
-
'@id': imageUrl,
|
|
118
|
-
url: imageUrl,
|
|
119
|
-
contentUrl: imageUrl,
|
|
120
|
-
caption,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=structuredDataUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"structuredDataUtils.js","sourceRoot":"","sources":["../../src/utils/structuredDataUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,eAAe,EAAoB,MAAM,wBAAwB,CAAC;AAC1E,OAAO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|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, {useMemo, type ReactNode, useContext} from 'react';
|
|
9
|
-
import {ReactContextError} from '../utils/reactUtils';
|
|
10
|
-
|
|
11
|
-
import type {PropBlogPostContent} from '@docusaurus/plugin-content-blog';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The React context value returned by the `useBlogPost()` hook.
|
|
15
|
-
* It contains useful data related to the currently browsed blog post.
|
|
16
|
-
*/
|
|
17
|
-
export type BlogPostContextValue = Pick<
|
|
18
|
-
PropBlogPostContent,
|
|
19
|
-
'metadata' | 'frontMatter' | 'assets' | 'toc'
|
|
20
|
-
> & {
|
|
21
|
-
readonly isBlogPostPage: boolean;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const Context = React.createContext<BlogPostContextValue | null>(null);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Note: we don't use `PropBlogPostContent` as context value on purpose.
|
|
28
|
-
* Metadata is currently stored inside the MDX component, but we may want to
|
|
29
|
-
* change that in the future.
|
|
30
|
-
*/
|
|
31
|
-
function useContextValue({
|
|
32
|
-
content,
|
|
33
|
-
isBlogPostPage,
|
|
34
|
-
}: {
|
|
35
|
-
content: PropBlogPostContent;
|
|
36
|
-
isBlogPostPage: boolean;
|
|
37
|
-
}): BlogPostContextValue {
|
|
38
|
-
return useMemo(
|
|
39
|
-
() => ({
|
|
40
|
-
metadata: content.metadata,
|
|
41
|
-
frontMatter: content.frontMatter,
|
|
42
|
-
assets: content.assets,
|
|
43
|
-
toc: content.toc,
|
|
44
|
-
isBlogPostPage,
|
|
45
|
-
}),
|
|
46
|
-
[content, isBlogPostPage],
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* This is a very thin layer around the `content` received from the MDX loader.
|
|
52
|
-
* It provides metadata about the blog post to the children tree.
|
|
53
|
-
*/
|
|
54
|
-
export function BlogPostProvider({
|
|
55
|
-
children,
|
|
56
|
-
content,
|
|
57
|
-
isBlogPostPage = false,
|
|
58
|
-
}: {
|
|
59
|
-
children: ReactNode;
|
|
60
|
-
content: PropBlogPostContent;
|
|
61
|
-
isBlogPostPage?: boolean;
|
|
62
|
-
}): JSX.Element {
|
|
63
|
-
const contextValue = useContextValue({content, isBlogPostPage});
|
|
64
|
-
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Returns the data of the currently browsed blog post. Gives access to
|
|
69
|
-
* front matter, metadata, TOC, etc.
|
|
70
|
-
* When swizzling a low-level component (e.g. the "Edit this page" link)
|
|
71
|
-
* and you need some extra metadata, you don't have to drill the props
|
|
72
|
-
* all the way through the component tree: simply use this hook instead.
|
|
73
|
-
*/
|
|
74
|
-
export function useBlogPost(): BlogPostContextValue {
|
|
75
|
-
const blogPost = useContext(Context);
|
|
76
|
-
if (blogPost === null) {
|
|
77
|
-
throw new ReactContextError('BlogPostProvider');
|
|
78
|
-
}
|
|
79
|
-
return blogPost;
|
|
80
|
-
}
|
package/src/utils/blogUtils.tsx
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, {type ReactNode, useMemo} from 'react';
|
|
9
|
-
import {useLocation} from '@docusaurus/router';
|
|
10
|
-
import Link from '@docusaurus/Link';
|
|
11
|
-
import {isSamePath} from './routesUtils';
|
|
12
|
-
import {groupBy} from './jsUtils';
|
|
13
|
-
import type {BlogSidebarItem} from '@docusaurus/plugin-content-blog';
|
|
14
|
-
|
|
15
|
-
function isVisible(item: BlogSidebarItem, pathname: string): boolean {
|
|
16
|
-
if (item.unlisted && !isSamePath(item.permalink, pathname)) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Return the visible blog sidebar items to display.
|
|
24
|
-
* Unlisted items are filtered.
|
|
25
|
-
*/
|
|
26
|
-
export function useVisibleBlogSidebarItems(
|
|
27
|
-
items: BlogSidebarItem[],
|
|
28
|
-
): BlogSidebarItem[] {
|
|
29
|
-
const {pathname} = useLocation();
|
|
30
|
-
return useMemo(
|
|
31
|
-
() => items.filter((item) => isVisible(item, pathname)),
|
|
32
|
-
[items, pathname],
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function groupBlogSidebarItemsByYear(
|
|
37
|
-
items: BlogSidebarItem[],
|
|
38
|
-
): [string, BlogSidebarItem[]][] {
|
|
39
|
-
const groupedByYear = groupBy(items, (item) => {
|
|
40
|
-
return `${new Date(item.date).getFullYear()}`;
|
|
41
|
-
});
|
|
42
|
-
// "as" is safe here
|
|
43
|
-
// see https://github.com/microsoft/TypeScript/pull/56805#issuecomment-2196526425
|
|
44
|
-
const entries = Object.entries(groupedByYear) as [
|
|
45
|
-
string,
|
|
46
|
-
BlogSidebarItem[],
|
|
47
|
-
][];
|
|
48
|
-
// We have to use entries because of https://x.com/sebastienlorber/status/1806371668614369486
|
|
49
|
-
// Objects with string/number keys are automatically sorted asc...
|
|
50
|
-
// Even if keys are strings like "2024"
|
|
51
|
-
// We want descending order for years
|
|
52
|
-
// Alternative: using Map.groupBy (not affected by this "reordering")
|
|
53
|
-
entries.reverse();
|
|
54
|
-
return entries;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function BlogSidebarItemList({
|
|
58
|
-
items,
|
|
59
|
-
ulClassName,
|
|
60
|
-
liClassName,
|
|
61
|
-
linkClassName,
|
|
62
|
-
linkActiveClassName,
|
|
63
|
-
}: {
|
|
64
|
-
items: BlogSidebarItem[];
|
|
65
|
-
ulClassName?: string;
|
|
66
|
-
liClassName?: string;
|
|
67
|
-
linkClassName?: string;
|
|
68
|
-
linkActiveClassName?: string;
|
|
69
|
-
}): ReactNode {
|
|
70
|
-
return (
|
|
71
|
-
<ul className={ulClassName}>
|
|
72
|
-
{items.map((item) => (
|
|
73
|
-
<li key={item.permalink} className={liClassName}>
|
|
74
|
-
<Link
|
|
75
|
-
isNavLink
|
|
76
|
-
to={item.permalink}
|
|
77
|
-
className={linkClassName}
|
|
78
|
-
activeClassName={linkActiveClassName}>
|
|
79
|
-
{item.title}
|
|
80
|
-
</Link>
|
|
81
|
-
</li>
|
|
82
|
-
))}
|
|
83
|
-
</ul>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {useBaseUrlUtils, type BaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
9
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
10
|
-
import {useBlogMetadata} from '@docusaurus/plugin-content-blog/client';
|
|
11
|
-
import type {Props as BlogListPageStructuredDataProps} from '@theme/BlogListPage/StructuredData';
|
|
12
|
-
import {useBlogPost} from '../contexts/blogPost';
|
|
13
|
-
import type {
|
|
14
|
-
Blog,
|
|
15
|
-
BlogPosting,
|
|
16
|
-
WithContext,
|
|
17
|
-
Person,
|
|
18
|
-
ImageObject,
|
|
19
|
-
} from 'schema-dts';
|
|
20
|
-
import type {
|
|
21
|
-
Author,
|
|
22
|
-
PropBlogPostContent,
|
|
23
|
-
} from '@docusaurus/plugin-content-blog';
|
|
24
|
-
import type {DocusaurusConfig} from '@docusaurus/types';
|
|
25
|
-
|
|
26
|
-
const convertDate = (dateMs: number) => new Date(dateMs).toISOString();
|
|
27
|
-
|
|
28
|
-
function getBlogPost(
|
|
29
|
-
blogPostContent: PropBlogPostContent,
|
|
30
|
-
siteConfig: DocusaurusConfig,
|
|
31
|
-
withBaseUrl: BaseUrlUtils['withBaseUrl'],
|
|
32
|
-
): BlogPosting {
|
|
33
|
-
const {assets, frontMatter, metadata} = blogPostContent;
|
|
34
|
-
const {date, title, description, lastUpdatedAt} = metadata;
|
|
35
|
-
|
|
36
|
-
const image = assets.image ?? frontMatter.image;
|
|
37
|
-
const keywords = frontMatter.keywords ?? [];
|
|
38
|
-
|
|
39
|
-
const blogUrl = `${siteConfig.url}${metadata.permalink}`;
|
|
40
|
-
|
|
41
|
-
const dateModified = lastUpdatedAt ? convertDate(lastUpdatedAt) : undefined;
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
'@type': 'BlogPosting',
|
|
45
|
-
'@id': blogUrl,
|
|
46
|
-
mainEntityOfPage: blogUrl,
|
|
47
|
-
url: blogUrl,
|
|
48
|
-
headline: title,
|
|
49
|
-
name: title,
|
|
50
|
-
description,
|
|
51
|
-
datePublished: date,
|
|
52
|
-
...(dateModified ? {dateModified} : {}),
|
|
53
|
-
...getAuthor(metadata.authors),
|
|
54
|
-
...getImage(image, withBaseUrl, title),
|
|
55
|
-
...(keywords ? {keywords} : {}),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function getAuthor(authors: Author[]) {
|
|
60
|
-
const authorsStructuredData = authors.map(createPersonStructuredData);
|
|
61
|
-
return {
|
|
62
|
-
author:
|
|
63
|
-
authorsStructuredData.length === 1
|
|
64
|
-
? authorsStructuredData[0]
|
|
65
|
-
: authorsStructuredData,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getImage(
|
|
70
|
-
image: string | undefined,
|
|
71
|
-
withBaseUrl: BaseUrlUtils['withBaseUrl'],
|
|
72
|
-
title: string,
|
|
73
|
-
) {
|
|
74
|
-
return image
|
|
75
|
-
? {
|
|
76
|
-
image: createImageStructuredData({
|
|
77
|
-
imageUrl: withBaseUrl(image, {absolute: true}),
|
|
78
|
-
caption: `title image for the blog post: ${title}`,
|
|
79
|
-
}),
|
|
80
|
-
}
|
|
81
|
-
: {};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function useBlogListPageStructuredData(
|
|
85
|
-
props: BlogListPageStructuredDataProps,
|
|
86
|
-
): WithContext<Blog> {
|
|
87
|
-
const {siteConfig} = useDocusaurusContext();
|
|
88
|
-
const {withBaseUrl} = useBaseUrlUtils();
|
|
89
|
-
|
|
90
|
-
const {
|
|
91
|
-
metadata: {blogDescription, blogTitle, permalink},
|
|
92
|
-
} = props;
|
|
93
|
-
|
|
94
|
-
const url = `${siteConfig.url}${permalink}`;
|
|
95
|
-
|
|
96
|
-
// details on structured data support: https://schema.org/Blog
|
|
97
|
-
return {
|
|
98
|
-
'@context': 'https://schema.org',
|
|
99
|
-
'@type': 'Blog',
|
|
100
|
-
'@id': url,
|
|
101
|
-
mainEntityOfPage: url,
|
|
102
|
-
headline: blogTitle,
|
|
103
|
-
description: blogDescription,
|
|
104
|
-
blogPost: props.items.map((blogItem) =>
|
|
105
|
-
getBlogPost(blogItem.content, siteConfig, withBaseUrl),
|
|
106
|
-
),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export function useBlogPostStructuredData(): WithContext<BlogPosting> {
|
|
111
|
-
const blogMetadata = useBlogMetadata();
|
|
112
|
-
const {assets, metadata} = useBlogPost();
|
|
113
|
-
const {siteConfig} = useDocusaurusContext();
|
|
114
|
-
const {withBaseUrl} = useBaseUrlUtils();
|
|
115
|
-
|
|
116
|
-
const {date, title, description, frontMatter, lastUpdatedAt} = metadata;
|
|
117
|
-
|
|
118
|
-
const image = assets.image ?? frontMatter.image;
|
|
119
|
-
const keywords = frontMatter.keywords ?? [];
|
|
120
|
-
|
|
121
|
-
const dateModified = lastUpdatedAt ? convertDate(lastUpdatedAt) : undefined;
|
|
122
|
-
|
|
123
|
-
const url = `${siteConfig.url}${metadata.permalink}`;
|
|
124
|
-
|
|
125
|
-
// details on structured data support: https://schema.org/BlogPosting
|
|
126
|
-
// BlogPosting is one of the structured data types that Google explicitly
|
|
127
|
-
// supports: https://developers.google.com/search/docs/appearance/structured-data/article#structured-data-type-definitions
|
|
128
|
-
return {
|
|
129
|
-
'@context': 'https://schema.org',
|
|
130
|
-
'@type': 'BlogPosting',
|
|
131
|
-
'@id': url,
|
|
132
|
-
mainEntityOfPage: url,
|
|
133
|
-
url,
|
|
134
|
-
headline: title,
|
|
135
|
-
name: title,
|
|
136
|
-
description,
|
|
137
|
-
datePublished: date,
|
|
138
|
-
...(dateModified ? {dateModified} : {}),
|
|
139
|
-
...getAuthor(metadata.authors),
|
|
140
|
-
...getImage(image, withBaseUrl, title),
|
|
141
|
-
...(keywords ? {keywords} : {}),
|
|
142
|
-
isPartOf: {
|
|
143
|
-
'@type': 'Blog',
|
|
144
|
-
'@id': `${siteConfig.url}${blogMetadata.blogBasePath}`,
|
|
145
|
-
name: blogMetadata.blogTitle,
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/** @returns A {@link https://schema.org/Person} constructed from the {@link Author} */
|
|
151
|
-
function createPersonStructuredData(author: Author): Person {
|
|
152
|
-
return {
|
|
153
|
-
'@type': 'Person',
|
|
154
|
-
...(author.name ? {name: author.name} : {}),
|
|
155
|
-
...(author.title ? {description: author.title} : {}),
|
|
156
|
-
...(author.url ? {url: author.url} : {}),
|
|
157
|
-
...(author.email ? {email: author.email} : {}),
|
|
158
|
-
...(author.imageURL ? {image: author.imageURL} : {}),
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/** @returns A {@link https://schema.org/ImageObject} */
|
|
163
|
-
function createImageStructuredData({
|
|
164
|
-
imageUrl,
|
|
165
|
-
caption,
|
|
166
|
-
}: {
|
|
167
|
-
imageUrl: string;
|
|
168
|
-
caption: string;
|
|
169
|
-
}): ImageObject {
|
|
170
|
-
return {
|
|
171
|
-
'@type': 'ImageObject',
|
|
172
|
-
'@id': imageUrl,
|
|
173
|
-
url: imageUrl,
|
|
174
|
-
contentUrl: imageUrl,
|
|
175
|
-
caption,
|
|
176
|
-
};
|
|
177
|
-
}
|