@docusaurus/theme-common 3.4.0 → 3.5.1

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.
Files changed (95) hide show
  1. package/lib/index.d.ts +5 -6
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +18 -6
  4. package/lib/index.js.map +1 -1
  5. package/lib/internal.d.ts +2 -9
  6. package/lib/internal.d.ts.map +1 -1
  7. package/lib/internal.js +2 -9
  8. package/lib/internal.js.map +1 -1
  9. package/lib/translations/blogTranslations.d.ts +19 -0
  10. package/lib/translations/blogTranslations.d.ts.map +1 -0
  11. package/lib/translations/blogTranslations.js +48 -0
  12. package/lib/translations/blogTranslations.js.map +1 -0
  13. package/lib/{utils/unlistedUtils.d.ts → translations/contentVisibilityTranslations.d.ts} +3 -2
  14. package/lib/translations/contentVisibilityTranslations.d.ts.map +1 -0
  15. package/lib/translations/contentVisibilityTranslations.js +39 -0
  16. package/lib/translations/contentVisibilityTranslations.js.map +1 -0
  17. package/lib/utils/ThemeClassNames.d.ts +3 -0
  18. package/lib/utils/ThemeClassNames.d.ts.map +1 -1
  19. package/lib/utils/ThemeClassNames.js +3 -0
  20. package/lib/utils/ThemeClassNames.js.map +1 -1
  21. package/lib/utils/errorBoundaryUtils.d.ts +0 -1
  22. package/lib/utils/errorBoundaryUtils.d.ts.map +1 -1
  23. package/lib/utils/jsUtils.d.ts +1 -0
  24. package/lib/utils/jsUtils.d.ts.map +1 -1
  25. package/lib/utils/jsUtils.js +14 -0
  26. package/lib/utils/jsUtils.js.map +1 -1
  27. package/lib/utils/searchUtils.d.ts +0 -13
  28. package/lib/utils/searchUtils.d.ts.map +1 -1
  29. package/lib/utils/searchUtils.js +0 -39
  30. package/lib/utils/searchUtils.js.map +1 -1
  31. package/lib/utils/storageUtils.d.ts +0 -1
  32. package/lib/utils/storageUtils.d.ts.map +1 -1
  33. package/lib/utils/tabsUtils.d.ts +2 -2
  34. package/lib/utils/tabsUtils.d.ts.map +1 -1
  35. package/lib/utils/useThemeConfig.d.ts +5 -0
  36. package/lib/utils/useThemeConfig.d.ts.map +1 -1
  37. package/lib/utils/useThemeConfig.js.map +1 -1
  38. package/package.json +9 -11
  39. package/src/index.ts +27 -16
  40. package/src/internal.ts +8 -36
  41. package/src/translations/blogTranslations.tsx +79 -0
  42. package/src/{utils/unlistedUtils.tsx → translations/contentVisibilityTranslations.tsx} +25 -2
  43. package/src/types.d.ts +0 -3
  44. package/src/utils/ThemeClassNames.ts +3 -0
  45. package/src/utils/jsUtils.ts +18 -0
  46. package/src/utils/searchUtils.ts +0 -58
  47. package/src/utils/useThemeConfig.ts +6 -0
  48. package/lib/contexts/blogPost.d.ts +0 -33
  49. package/lib/contexts/blogPost.d.ts.map +0 -1
  50. package/lib/contexts/blogPost.js +0 -46
  51. package/lib/contexts/blogPost.js.map +0 -1
  52. package/lib/contexts/doc.d.ts +0 -30
  53. package/lib/contexts/doc.d.ts.map +0 -1
  54. package/lib/contexts/doc.js +0 -48
  55. package/lib/contexts/doc.js.map +0 -1
  56. package/lib/contexts/docSidebarItemsExpandedState.d.ts +0 -31
  57. package/lib/contexts/docSidebarItemsExpandedState.d.ts.map +0 -1
  58. package/lib/contexts/docSidebarItemsExpandedState.js +0 -28
  59. package/lib/contexts/docSidebarItemsExpandedState.js.map +0 -1
  60. package/lib/contexts/docsPreferredVersion.d.ts +0 -30
  61. package/lib/contexts/docsPreferredVersion.d.ts.map +0 -1
  62. package/lib/contexts/docsPreferredVersion.js +0 -130
  63. package/lib/contexts/docsPreferredVersion.js.map +0 -1
  64. package/lib/contexts/docsSidebar.d.ts +0 -26
  65. package/lib/contexts/docsSidebar.d.ts.map +0 -1
  66. package/lib/contexts/docsSidebar.js +0 -30
  67. package/lib/contexts/docsSidebar.js.map +0 -1
  68. package/lib/contexts/docsVersion.d.ts +0 -20
  69. package/lib/contexts/docsVersion.d.ts.map +0 -1
  70. package/lib/contexts/docsVersion.js +0 -26
  71. package/lib/contexts/docsVersion.js.map +0 -1
  72. package/lib/utils/blogUtils.d.ts +0 -13
  73. package/lib/utils/blogUtils.d.ts.map +0 -1
  74. package/lib/utils/blogUtils.js +0 -24
  75. package/lib/utils/blogUtils.js.map +0 -1
  76. package/lib/utils/docsUtils.d.ts +0 -109
  77. package/lib/utils/docsUtils.d.ts.map +0 -1
  78. package/lib/utils/docsUtils.js +0 -276
  79. package/lib/utils/docsUtils.js.map +0 -1
  80. package/lib/utils/structuredDataUtils.d.ts +0 -12
  81. package/lib/utils/structuredDataUtils.d.ts.map +0 -1
  82. package/lib/utils/structuredDataUtils.js +0 -123
  83. package/lib/utils/structuredDataUtils.js.map +0 -1
  84. package/lib/utils/unlistedUtils.d.ts.map +0 -1
  85. package/lib/utils/unlistedUtils.js +0 -26
  86. package/lib/utils/unlistedUtils.js.map +0 -1
  87. package/src/contexts/blogPost.tsx +0 -80
  88. package/src/contexts/doc.tsx +0 -71
  89. package/src/contexts/docSidebarItemsExpandedState.tsx +0 -55
  90. package/src/contexts/docsPreferredVersion.tsx +0 -251
  91. package/src/contexts/docsSidebar.tsx +0 -50
  92. package/src/contexts/docsVersion.tsx +0 -36
  93. package/src/utils/blogUtils.ts +0 -32
  94. package/src/utils/docsUtils.tsx +0 -418
  95. package/src/utils/structuredDataUtils.ts +0 -177
@@ -1,276 +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 { useMemo } from 'react';
8
- import { matchPath, useLocation } from '@docusaurus/router';
9
- import renderRoutes from '@docusaurus/renderRoutes';
10
- import { useAllDocsData, useActivePlugin, useActiveDocContext, useLatestVersion, } from '@docusaurus/plugin-content-docs/client';
11
- import { useDocsPreferredVersion } from '../contexts/docsPreferredVersion';
12
- import { useDocsVersion } from '../contexts/docsVersion';
13
- import { useDocsSidebar } from '../contexts/docsSidebar';
14
- import { uniq } from './jsUtils';
15
- import { isSamePath } from './routesUtils';
16
- // TODO not ideal, see also "useDocs"
17
- export const isDocsPluginEnabled = !!useAllDocsData;
18
- export function useDocById(id) {
19
- const version = useDocsVersion();
20
- if (!id) {
21
- return undefined;
22
- }
23
- const doc = version.docs[id];
24
- if (!doc) {
25
- throw new Error(`no version doc found by id=${id}`);
26
- }
27
- return doc;
28
- }
29
- /**
30
- * Pure function, similar to `Array#find`, but works on the sidebar tree.
31
- */
32
- export function findSidebarCategory(sidebar, predicate) {
33
- for (const item of sidebar) {
34
- if (item.type === 'category') {
35
- if (predicate(item)) {
36
- return item;
37
- }
38
- const subItem = findSidebarCategory(item.items, predicate);
39
- if (subItem) {
40
- return subItem;
41
- }
42
- }
43
- }
44
- return undefined;
45
- }
46
- /**
47
- * Best effort to assign a link to a sidebar category. If the category doesn't
48
- * have a link itself, we link to the first sub item with a link.
49
- */
50
- export function findFirstSidebarItemCategoryLink(item) {
51
- if (item.href && !item.linkUnlisted) {
52
- return item.href;
53
- }
54
- for (const subItem of item.items) {
55
- const link = findFirstSidebarItemLink(subItem);
56
- if (link) {
57
- return link;
58
- }
59
- }
60
- return undefined;
61
- }
62
- /**
63
- * Best effort to assign a link to a sidebar item.
64
- */
65
- export function findFirstSidebarItemLink(item) {
66
- if (item.type === 'link' && !item.unlisted) {
67
- return item.href;
68
- }
69
- if (item.type === 'category') {
70
- return findFirstSidebarItemCategoryLink(item);
71
- }
72
- // Other items types, like "html"
73
- return undefined;
74
- }
75
- /**
76
- * Gets the category associated with the current location. Should only be used
77
- * on category index pages.
78
- */
79
- export function useCurrentSidebarCategory() {
80
- const { pathname } = useLocation();
81
- const sidebar = useDocsSidebar();
82
- if (!sidebar) {
83
- throw new Error('Unexpected: cant find current sidebar in context');
84
- }
85
- const categoryBreadcrumbs = getSidebarBreadcrumbs({
86
- sidebarItems: sidebar.items,
87
- pathname,
88
- onlyCategories: true,
89
- });
90
- const deepestCategory = categoryBreadcrumbs.slice(-1)[0];
91
- if (!deepestCategory) {
92
- throw new Error(`${pathname} is not associated with a category. useCurrentSidebarCategory() should only be used on category index pages.`);
93
- }
94
- return deepestCategory;
95
- }
96
- const isActive = (testedPath, activePath) => typeof testedPath !== 'undefined' && isSamePath(testedPath, activePath);
97
- const containsActiveSidebarItem = (items, activePath) => items.some((subItem) => isActiveSidebarItem(subItem, activePath));
98
- /**
99
- * Checks if a sidebar item should be active, based on the active path.
100
- */
101
- export function isActiveSidebarItem(item, activePath) {
102
- if (item.type === 'link') {
103
- return isActive(item.href, activePath);
104
- }
105
- if (item.type === 'category') {
106
- return (isActive(item.href, activePath) ||
107
- containsActiveSidebarItem(item.items, activePath));
108
- }
109
- return false;
110
- }
111
- export function isVisibleSidebarItem(item, activePath) {
112
- switch (item.type) {
113
- case 'category':
114
- return (isActiveSidebarItem(item, activePath) ||
115
- item.items.some((subItem) => isVisibleSidebarItem(subItem, activePath)));
116
- case 'link':
117
- // An unlisted item remains visible if it is active
118
- return !item.unlisted || isActiveSidebarItem(item, activePath);
119
- default:
120
- return true;
121
- }
122
- }
123
- export function useVisibleSidebarItems(items, activePath) {
124
- return useMemo(() => items.filter((item) => isVisibleSidebarItem(item, activePath)), [items, activePath]);
125
- }
126
- /**
127
- * Get the sidebar the breadcrumbs for a given pathname
128
- * Ordered from top to bottom
129
- */
130
- function getSidebarBreadcrumbs({ sidebarItems, pathname, onlyCategories = false, }) {
131
- const breadcrumbs = [];
132
- function extract(items) {
133
- for (const item of items) {
134
- if ((item.type === 'category' &&
135
- (isSamePath(item.href, pathname) || extract(item.items))) ||
136
- (item.type === 'link' && isSamePath(item.href, pathname))) {
137
- const filtered = onlyCategories && item.type !== 'category';
138
- if (!filtered) {
139
- breadcrumbs.unshift(item);
140
- }
141
- return true;
142
- }
143
- }
144
- return false;
145
- }
146
- extract(sidebarItems);
147
- return breadcrumbs;
148
- }
149
- /**
150
- * Gets the breadcrumbs of the current doc page, based on its sidebar location.
151
- * Returns `null` if there's no sidebar or breadcrumbs are disabled.
152
- */
153
- export function useSidebarBreadcrumbs() {
154
- const sidebar = useDocsSidebar();
155
- const { pathname } = useLocation();
156
- const breadcrumbsOption = useActivePlugin()?.pluginData.breadcrumbs;
157
- if (breadcrumbsOption === false || !sidebar) {
158
- return null;
159
- }
160
- return getSidebarBreadcrumbs({ sidebarItems: sidebar.items, pathname });
161
- }
162
- /**
163
- * "Version candidates" are mostly useful for the layout components, which must
164
- * be able to work on all pages. For example, if a user has `{ type: "doc",
165
- * docId: "intro" }` as a navbar item, which version does that refer to? We
166
- * believe that it could refer to at most three version candidates:
167
- *
168
- * 1. The **active version**, the one that the user is currently browsing. See
169
- * {@link useActiveDocContext}.
170
- * 2. The **preferred version**, the one that the user last visited. See
171
- * {@link useDocsPreferredVersion}.
172
- * 3. The **latest version**, the "default". See {@link useLatestVersion}.
173
- *
174
- * @param docsPluginId The plugin ID to get versions from.
175
- * @returns An array of 1~3 versions with priorities defined above, guaranteed
176
- * to be unique and non-sparse. Will be memoized, hence stable for deps array.
177
- */
178
- export function useDocsVersionCandidates(docsPluginId) {
179
- const { activeVersion } = useActiveDocContext(docsPluginId);
180
- const { preferredVersion } = useDocsPreferredVersion(docsPluginId);
181
- const latestVersion = useLatestVersion(docsPluginId);
182
- return useMemo(() => uniq([activeVersion, preferredVersion, latestVersion].filter(Boolean)), [activeVersion, preferredVersion, latestVersion]);
183
- }
184
- /**
185
- * The layout components, like navbar items, must be able to work on all pages,
186
- * even on non-doc ones where there's no version context, so a sidebar ID could
187
- * be ambiguous. This hook would always return a sidebar to be linked to. See
188
- * also {@link useDocsVersionCandidates} for how this selection is done.
189
- *
190
- * @throws This hook throws if a sidebar with said ID is not found.
191
- */
192
- export function useLayoutDocsSidebar(sidebarId, docsPluginId) {
193
- const versions = useDocsVersionCandidates(docsPluginId);
194
- return useMemo(() => {
195
- const allSidebars = versions.flatMap((version) => version.sidebars ? Object.entries(version.sidebars) : []);
196
- const sidebarEntry = allSidebars.find((sidebar) => sidebar[0] === sidebarId);
197
- if (!sidebarEntry) {
198
- throw new Error(`Can't find any sidebar with id "${sidebarId}" in version${versions.length > 1 ? 's' : ''} ${versions.map((version) => version.name).join(', ')}".
199
- Available sidebar ids are:
200
- - ${allSidebars.map((entry) => entry[0]).join('\n- ')}`);
201
- }
202
- return sidebarEntry[1];
203
- }, [sidebarId, versions]);
204
- }
205
- /**
206
- * The layout components, like navbar items, must be able to work on all pages,
207
- * even on non-doc ones where there's no version context, so a doc ID could be
208
- * ambiguous. This hook would always return a doc to be linked to. See also
209
- * {@link useDocsVersionCandidates} for how this selection is done.
210
- *
211
- * @throws This hook throws if a doc with said ID is not found.
212
- */
213
- export function useLayoutDoc(docId, docsPluginId) {
214
- const versions = useDocsVersionCandidates(docsPluginId);
215
- return useMemo(() => {
216
- const allDocs = versions.flatMap((version) => version.docs);
217
- const doc = allDocs.find((versionDoc) => versionDoc.id === docId);
218
- if (!doc) {
219
- const isDraft = versions
220
- .flatMap((version) => version.draftIds)
221
- .includes(docId);
222
- // Drafts should be silently filtered instead of throwing
223
- if (isDraft) {
224
- return null;
225
- }
226
- throw new Error(`Couldn't find any doc with id "${docId}" in version${versions.length > 1 ? 's' : ''} "${versions.map((version) => version.name).join(', ')}".
227
- Available doc ids are:
228
- - ${uniq(allDocs.map((versionDoc) => versionDoc.id)).join('\n- ')}`);
229
- }
230
- return doc;
231
- }, [docId, versions]);
232
- }
233
- // TODO later read version/route directly from context
234
- /**
235
- * The docs plugin creates nested routes, with the top-level route providing the
236
- * version metadata, and the subroutes creating individual doc pages. This hook
237
- * will match the current location against all known sub-routes.
238
- *
239
- * @param props The props received by `@theme/DocRoot`
240
- * @returns The data of the relevant document at the current location, or `null`
241
- * if no document associated with the current location can be found.
242
- */
243
- export function useDocRootMetadata({ route }) {
244
- const location = useLocation();
245
- const versionMetadata = useDocsVersion();
246
- const docRoutes = route.routes;
247
- const currentDocRoute = docRoutes.find((docRoute) => matchPath(location.pathname, docRoute));
248
- if (!currentDocRoute) {
249
- return null;
250
- }
251
- // For now, the sidebarName is added as route config: not ideal!
252
- const sidebarName = currentDocRoute.sidebar;
253
- const sidebarItems = sidebarName
254
- ? versionMetadata.docsSidebars[sidebarName]
255
- : undefined;
256
- const docElement = renderRoutes(docRoutes);
257
- return {
258
- docElement,
259
- sidebarName,
260
- sidebarItems,
261
- };
262
- }
263
- /**
264
- * Filter items we don't want to display on the doc card list view
265
- * @param items
266
- */
267
- export function filterDocCardListItems(items) {
268
- return items.filter((item) => {
269
- const canHaveLink = item.type === 'category' || item.type === 'link';
270
- if (canHaveLink) {
271
- return !!findFirstSidebarItemLink(item);
272
- }
273
- return true;
274
- });
275
- }
276
- //# sourceMappingURL=docsUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docsUtils.js","sourceRoot":"","sources":["../../src/utils/docsUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,gBAAgB,GAIjB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AASzC,qCAAqC;AACrC,MAAM,CAAC,MAAM,mBAAmB,GAAY,CAAC,CAAC,cAAc,CAAC;AAU7D,MAAM,UAAU,UAAU,CAAC,EAAsB;IAC/C,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,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AAsD;AACtD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAC,KAAK,EAAe;IAWtD,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,eAAe,GAAG,cAAc,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAO,CAAC;IAChC,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAClD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACvC,CAAC;IACF,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gEAAgE;IAChE,MAAM,WAAW,GAAG,eAAe,CAAC,OAAiB,CAAC;IAEtD,MAAM,YAAY,GAAG,WAAW;QAC9B,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,WAAW,CAAC;QAC3C,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,UAAU,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE3C,OAAO;QACL,UAAU;QACV,WAAW;QACX,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAwB;IAExB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;QACrE,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,12 +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
- /// <reference types="@docusaurus/plugin-content-blog" />
8
- import type { Props as BlogListPageStructuredDataProps } from '@theme/BlogListPage/StructuredData';
9
- import type { Blog, BlogPosting, WithContext } from 'schema-dts';
10
- export declare function useBlogListPageStructuredData(props: BlogListPageStructuredDataProps): WithContext<Blog>;
11
- export declare function useBlogPostStructuredData(): WithContext<BlogPosting>;
12
- //# 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,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAcjD,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,IAAI,CAA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AAI,GAAG,CAAC,OAAO,CAM9C"}
@@ -1,26 +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 from 'react';
8
- import Translate from '@docusaurus/Translate';
9
- import Head from '@docusaurus/Head';
10
- export function UnlistedBannerTitle() {
11
- return (<Translate id="theme.unlistedContent.title" description="The unlisted content banner title">
12
- Unlisted page
13
- </Translate>);
14
- }
15
- export function UnlistedBannerMessage() {
16
- return (<Translate id="theme.unlistedContent.message" description="The unlisted content banner message">
17
- This page is unlisted. Search engines will not index it, and only users
18
- having a direct link can access it.
19
- </Translate>);
20
- }
21
- export function UnlistedMetadata() {
22
- return (<Head>
23
- <meta name="robots" content="noindex, nofollow"/>
24
- </Head>);
25
- }
26
- //# sourceMappingURL=unlistedUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unlistedUtils.js","sourceRoot":"","sources":["../../src/utils/unlistedUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAEpC,MAAM,UAAU,mBAAmB;IACjC,OAAO,CACL,CAAC,SAAS,CACR,EAAE,CAAC,6BAA6B,CAChC,WAAW,CAAC,mCAAmC,CAC/C;;IACF,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,CACL,CAAC,SAAS,CACR,EAAE,CAAC,+BAA+B,CAClC,WAAW,CAAC,qCAAqC,CACjD;;;IAEF,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CACL,CAAC,IAAI,CACH;MAAA,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,mBAAmB,EACjD;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC"}
@@ -1,80 +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, {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
- }
@@ -1,71 +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, {useMemo, type ReactNode, useContext} from 'react';
9
- import {ReactContextError} from '../utils/reactUtils';
10
- import type {PropDocContent} from '@docusaurus/plugin-content-docs';
11
-
12
- /**
13
- * The React context value returned by the `useDoc()` hook.
14
- * It contains useful data related to the currently browsed doc.
15
- */
16
- export type DocContextValue = Pick<
17
- PropDocContent,
18
- 'metadata' | 'frontMatter' | 'toc' | 'assets' | 'contentTitle'
19
- >;
20
-
21
- const Context = React.createContext<DocContextValue | null>(null);
22
-
23
- /**
24
- * Note: we don't use `PropDoc` as context value on purpose. Metadata is
25
- * currently stored inside the MDX component, but we may want to change that in
26
- * the future. This layer is a good opportunity to decouple storage from
27
- * consuming API, potentially allowing us to provide metadata as both props and
28
- * route context without duplicating the chunks in the future.
29
- */
30
- function useContextValue(content: PropDocContent): DocContextValue {
31
- return useMemo(
32
- () => ({
33
- metadata: content.metadata,
34
- frontMatter: content.frontMatter,
35
- assets: content.assets,
36
- contentTitle: content.contentTitle,
37
- toc: content.toc,
38
- }),
39
- [content],
40
- );
41
- }
42
-
43
- /**
44
- * This is a very thin layer around the `content` received from the MDX loader.
45
- * It provides metadata about the doc to the children tree.
46
- */
47
- export function DocProvider({
48
- children,
49
- content,
50
- }: {
51
- children: ReactNode;
52
- content: PropDocContent;
53
- }): JSX.Element {
54
- const contextValue = useContextValue(content);
55
- return <Context.Provider value={contextValue}>{children}</Context.Provider>;
56
- }
57
-
58
- /**
59
- * Returns the data of the currently browsed doc. Gives access to the doc's MDX
60
- * Component, front matter, metadata, TOC, etc. When swizzling a low-level
61
- * component (e.g. the "Edit this page" link) and you need some extra metadata,
62
- * you don't have to drill the props all the way through the component tree:
63
- * simply use this hook instead.
64
- */
65
- export function useDoc(): DocContextValue {
66
- const doc = useContext(Context);
67
- if (doc === null) {
68
- throw new ReactContextError('DocProvider');
69
- }
70
- return doc;
71
- }