@docusaurus/theme-classic 0.0.0-5362 → 0.0.0-5367
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/BlogPostPage/index.js +3 -1
- package/lib/theme/BlogSidebar/Desktop/index.js +3 -1
- package/lib/theme/BlogSidebar/Mobile/index.js +3 -1
- package/lib/theme/BlogTagsPostsPage/index.js +2 -1
- package/lib/theme/DocBreadcrumbs/index.js +6 -2
- package/lib/theme/DocItem/Layout/index.js +5 -0
- package/lib/theme/DocSidebarItem/Category/index.js +1 -1
- package/lib/theme/DocSidebarItems/index.js +6 -4
- package/lib/theme/DocTagDocListPage/index.js +2 -0
- package/lib/theme/MDXPage/index.js +3 -1
- package/lib/theme/NavbarItem/DocNavbarItem.js +4 -3
- package/lib/theme/Unlisted/index.d.ts +9 -0
- package/lib/theme/Unlisted/index.js +38 -0
- package/package.json +14 -14
- package/src/theme/BlogPostPage/index.tsx +3 -1
- package/src/theme/BlogSidebar/Desktop/index.tsx +3 -1
- package/src/theme/BlogSidebar/Mobile/index.tsx +3 -1
- package/src/theme/BlogTagsPostsPage/index.tsx +2 -1
- package/src/theme/DocBreadcrumbs/index.tsx +6 -2
- package/src/theme/DocItem/Layout/index.tsx +5 -0
- package/src/theme/DocSidebarItem/Category/index.tsx +1 -1
- package/src/theme/DocSidebarItems/index.tsx +6 -4
- package/src/theme/DocTagDocListPage/index.tsx +2 -0
- package/src/theme/MDXPage/index.tsx +3 -1
- package/src/theme/NavbarItem/DocNavbarItem.tsx +4 -3
- package/src/theme/Unlisted/index.tsx +42 -0
- package/src/theme-classic.d.ts +8 -0
|
@@ -13,9 +13,10 @@ import BlogPostItem from '@theme/BlogPostItem';
|
|
|
13
13
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
14
14
|
import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
|
|
15
15
|
import TOC from '@theme/TOC';
|
|
16
|
+
import Unlisted from '@theme/Unlisted';
|
|
16
17
|
function BlogPostPageContent({sidebar, children}) {
|
|
17
18
|
const {metadata, toc} = useBlogPost();
|
|
18
|
-
const {nextItem, prevItem, frontMatter} = metadata;
|
|
19
|
+
const {nextItem, prevItem, frontMatter, unlisted} = metadata;
|
|
19
20
|
const {
|
|
20
21
|
hide_table_of_contents: hideTableOfContents,
|
|
21
22
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
@@ -33,6 +34,7 @@ function BlogPostPageContent({sidebar, children}) {
|
|
|
33
34
|
/>
|
|
34
35
|
) : undefined
|
|
35
36
|
}>
|
|
37
|
+
{unlisted && <Unlisted />}
|
|
36
38
|
<BlogPostItem>{children}</BlogPostItem>
|
|
37
39
|
|
|
38
40
|
{(nextItem || prevItem) && (
|
|
@@ -8,8 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Link from '@docusaurus/Link';
|
|
10
10
|
import {translate} from '@docusaurus/Translate';
|
|
11
|
+
import {useVisibleBlogSidebarItems} from '@docusaurus/theme-common/internal';
|
|
11
12
|
import styles from './styles.module.css';
|
|
12
13
|
export default function BlogSidebarDesktop({sidebar}) {
|
|
14
|
+
const items = useVisibleBlogSidebarItems(sidebar.items);
|
|
13
15
|
return (
|
|
14
16
|
<aside className="col col--3">
|
|
15
17
|
<nav
|
|
@@ -23,7 +25,7 @@ export default function BlogSidebarDesktop({sidebar}) {
|
|
|
23
25
|
{sidebar.title}
|
|
24
26
|
</div>
|
|
25
27
|
<ul className={clsx(styles.sidebarItemList, 'clean-list')}>
|
|
26
|
-
{
|
|
28
|
+
{items.map((item) => (
|
|
27
29
|
<li key={item.permalink} className={styles.sidebarItem}>
|
|
28
30
|
<Link
|
|
29
31
|
isNavLink
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Link from '@docusaurus/Link';
|
|
9
|
+
import {useVisibleBlogSidebarItems} from '@docusaurus/theme-common/internal';
|
|
9
10
|
import {NavbarSecondaryMenuFiller} from '@docusaurus/theme-common';
|
|
10
11
|
function BlogSidebarMobileSecondaryMenu({sidebar}) {
|
|
12
|
+
const items = useVisibleBlogSidebarItems(sidebar.items);
|
|
11
13
|
return (
|
|
12
14
|
<ul className="menu__list">
|
|
13
|
-
{
|
|
15
|
+
{items.map((item) => (
|
|
14
16
|
<li key={item.permalink} className="menu__list-item">
|
|
15
17
|
<Link
|
|
16
18
|
isNavLink
|
|
@@ -18,6 +18,7 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
18
18
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
19
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
20
|
import BlogPostItems from '@theme/BlogPostItems';
|
|
21
|
+
import Unlisted from '@theme/Unlisted';
|
|
21
22
|
// Very simple pluralization: probably good enough for now
|
|
22
23
|
function useBlogPostsPlural() {
|
|
23
24
|
const {selectMessage} = usePluralForm();
|
|
@@ -59,9 +60,9 @@ function BlogTagsPostsPageContent({tag, items, sidebar, listMetadata}) {
|
|
|
59
60
|
const title = useBlogTagsPostsPageTitle(tag);
|
|
60
61
|
return (
|
|
61
62
|
<BlogLayout sidebar={sidebar}>
|
|
63
|
+
{tag.unlisted && <Unlisted />}
|
|
62
64
|
<header className="margin-bottom--xl">
|
|
63
65
|
<h1>{title}</h1>
|
|
64
|
-
|
|
65
66
|
<Link href={tag.allTagsPath}>
|
|
66
67
|
<Translate
|
|
67
68
|
id="theme.tags.tagsPageLink"
|
|
@@ -97,13 +97,17 @@ export default function DocBreadcrumbs() {
|
|
|
97
97
|
{homePageRoute && <HomeBreadcrumbItem />}
|
|
98
98
|
{breadcrumbs.map((item, idx) => {
|
|
99
99
|
const isLast = idx === breadcrumbs.length - 1;
|
|
100
|
+
const href =
|
|
101
|
+
item.type === 'category' && item.linkUnlisted
|
|
102
|
+
? undefined
|
|
103
|
+
: item.href;
|
|
100
104
|
return (
|
|
101
105
|
<BreadcrumbsItem
|
|
102
106
|
key={idx}
|
|
103
107
|
active={isLast}
|
|
104
108
|
index={idx}
|
|
105
|
-
addMicrodata={!!
|
|
106
|
-
<BreadcrumbsItemLink href={
|
|
109
|
+
addMicrodata={!!href}>
|
|
110
|
+
<BreadcrumbsItemLink href={href} isLast={isLast}>
|
|
107
111
|
{item.label}
|
|
108
112
|
</BreadcrumbsItemLink>
|
|
109
113
|
</BreadcrumbsItem>
|
|
@@ -16,6 +16,7 @@ import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
|
|
|
16
16
|
import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
|
|
17
17
|
import DocItemContent from '@theme/DocItem/Content';
|
|
18
18
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
19
|
+
import Unlisted from '@theme/Unlisted';
|
|
19
20
|
import styles from './styles.module.css';
|
|
20
21
|
/**
|
|
21
22
|
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
@@ -38,9 +39,13 @@ function useDocTOC() {
|
|
|
38
39
|
}
|
|
39
40
|
export default function DocItemLayout({children}) {
|
|
40
41
|
const docTOC = useDocTOC();
|
|
42
|
+
const {
|
|
43
|
+
metadata: {unlisted},
|
|
44
|
+
} = useDoc();
|
|
41
45
|
return (
|
|
42
46
|
<div className="row">
|
|
43
47
|
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
|
|
48
|
+
{unlisted && <Unlisted />}
|
|
44
49
|
<DocVersionBanner />
|
|
45
50
|
<div className={styles.docItemContainer}>
|
|
46
51
|
<article>
|
|
@@ -45,7 +45,7 @@ function useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed}) {
|
|
|
45
45
|
function useCategoryHrefWithSSRFallback(item) {
|
|
46
46
|
const isBrowser = useIsBrowser();
|
|
47
47
|
return useMemo(() => {
|
|
48
|
-
if (item.href) {
|
|
48
|
+
if (item.href && !item.linkUnlisted) {
|
|
49
49
|
return item.href;
|
|
50
50
|
}
|
|
51
51
|
// In these cases, it's not necessary to render a fallback
|
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, {memo} from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
DocSidebarItemsExpandedStateProvider,
|
|
10
|
+
useVisibleSidebarItems,
|
|
11
|
+
} from '@docusaurus/theme-common/internal';
|
|
9
12
|
import DocSidebarItem from '@theme/DocSidebarItem';
|
|
10
|
-
// TODO this item should probably not receive the "activePath" props
|
|
11
|
-
// TODO this triggers whole sidebar re-renders on navigation
|
|
12
13
|
function DocSidebarItems({items, ...props}) {
|
|
14
|
+
const visibleItems = useVisibleSidebarItems(items, props.activePath);
|
|
13
15
|
return (
|
|
14
16
|
<DocSidebarItemsExpandedStateProvider>
|
|
15
|
-
{
|
|
17
|
+
{visibleItems.map((item, index) => (
|
|
16
18
|
<DocSidebarItem key={index} item={item} index={index} {...props} />
|
|
17
19
|
))}
|
|
18
20
|
</DocSidebarItemsExpandedStateProvider>
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
16
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
17
17
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
18
|
+
import Unlisted from '@theme/Unlisted';
|
|
18
19
|
// Very simple pluralization: probably good enough for now
|
|
19
20
|
function useNDocsTaggedPlural() {
|
|
20
21
|
const {selectMessage} = usePluralForm();
|
|
@@ -68,6 +69,7 @@ function DocTagDocListPageContent({tag, title}) {
|
|
|
68
69
|
<div className="container margin-vert--lg">
|
|
69
70
|
<div className="row">
|
|
70
71
|
<main className="col col--8 col--offset-2">
|
|
72
|
+
{tag.unlisted && <Unlisted />}
|
|
71
73
|
<header className="margin-bottom--xl">
|
|
72
74
|
<h1>{title}</h1>
|
|
73
75
|
<Link href={tag.allTagsPath}>
|
|
@@ -14,11 +14,12 @@ import {
|
|
|
14
14
|
import Layout from '@theme/Layout';
|
|
15
15
|
import MDXContent from '@theme/MDXContent';
|
|
16
16
|
import TOC from '@theme/TOC';
|
|
17
|
+
import Unlisted from '@theme/Unlisted';
|
|
17
18
|
import styles from './styles.module.css';
|
|
18
19
|
export default function MDXPage(props) {
|
|
19
20
|
const {content: MDXPageContent} = props;
|
|
20
21
|
const {
|
|
21
|
-
metadata: {title, description, frontMatter},
|
|
22
|
+
metadata: {title, description, frontMatter, unlisted},
|
|
22
23
|
} = MDXPageContent;
|
|
23
24
|
const {wrapperClassName, hide_table_of_contents: hideTableOfContents} =
|
|
24
25
|
frontMatter;
|
|
@@ -33,6 +34,7 @@ export default function MDXPage(props) {
|
|
|
33
34
|
<main className="container container--fluid margin-vert--lg">
|
|
34
35
|
<div className={clsx('row', styles.mdxPageWrapper)}>
|
|
35
36
|
<div className={clsx('col', !hideTableOfContents && 'col--8')}>
|
|
37
|
+
{unlisted && <Unlisted />}
|
|
36
38
|
<article>
|
|
37
39
|
<MDXContent>
|
|
38
40
|
<MDXPageContent />
|
|
@@ -16,8 +16,9 @@ export default function DocNavbarItem({
|
|
|
16
16
|
}) {
|
|
17
17
|
const {activeDoc} = useActiveDocContext(docsPluginId);
|
|
18
18
|
const doc = useLayoutDoc(docId, docsPluginId);
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const pageActive = activeDoc?.path === doc?.path;
|
|
20
|
+
// Draft and unlisted items are not displayed in the navbar.
|
|
21
|
+
if (doc === null || (doc.unlisted && !pageActive)) {
|
|
21
22
|
return null;
|
|
22
23
|
}
|
|
23
24
|
return (
|
|
@@ -25,7 +26,7 @@ export default function DocNavbarItem({
|
|
|
25
26
|
exact
|
|
26
27
|
{...props}
|
|
27
28
|
isActive={() =>
|
|
28
|
-
|
|
29
|
+
pageActive ||
|
|
29
30
|
(!!activeDoc?.sidebar && activeDoc.sidebar === doc.sidebar)
|
|
30
31
|
}
|
|
31
32
|
label={staticLabel ?? doc.id}
|
|
@@ -0,0 +1,9 @@
|
|
|
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="react" />
|
|
8
|
+
import type { Props } from '@theme/Unlisted';
|
|
9
|
+
export default function Unlisted(props: Props): JSX.Element | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 clsx from 'clsx';
|
|
9
|
+
import {
|
|
10
|
+
ThemeClassNames,
|
|
11
|
+
UnlistedBannerTitle,
|
|
12
|
+
UnlistedBannerMessage,
|
|
13
|
+
UnlistedMetadata,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
15
|
+
import Admonition from '@theme/Admonition';
|
|
16
|
+
function UnlistedBanner({className}) {
|
|
17
|
+
return (
|
|
18
|
+
<Admonition
|
|
19
|
+
type="caution"
|
|
20
|
+
title={<UnlistedBannerTitle />}
|
|
21
|
+
className={clsx(className, ThemeClassNames.common.unlistedBanner)}>
|
|
22
|
+
<UnlistedBannerMessage />
|
|
23
|
+
</Admonition>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
export default function Unlisted(props) {
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
{/*
|
|
30
|
+
Unlisted metadata declared here for simplicity.
|
|
31
|
+
Ensures we never forget to add the correct noindex metadata.
|
|
32
|
+
Also gives a central place for user to swizzle override default metadata.
|
|
33
|
+
*/}
|
|
34
|
+
<UnlistedMetadata />
|
|
35
|
+
<UnlistedBanner {...props} />
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5367",
|
|
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": "0.0.0-
|
|
24
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
25
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
31
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
23
|
+
"@docusaurus/core": "0.0.0-5367",
|
|
24
|
+
"@docusaurus/mdx-loader": "0.0.0-5367",
|
|
25
|
+
"@docusaurus/module-type-aliases": "0.0.0-5367",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5367",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5367",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5367",
|
|
29
|
+
"@docusaurus/theme-common": "0.0.0-5367",
|
|
30
|
+
"@docusaurus/theme-translations": "0.0.0-5367",
|
|
31
|
+
"@docusaurus/types": "0.0.0-5367",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-5367",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-5367",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5367",
|
|
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": "4cb5f25e6e83097230018df14308090a9dd8df20"
|
|
66
66
|
}
|
|
@@ -15,6 +15,7 @@ import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
|
15
15
|
import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
|
|
16
16
|
import TOC from '@theme/TOC';
|
|
17
17
|
import type {Props} from '@theme/BlogPostPage';
|
|
18
|
+
import Unlisted from '@theme/Unlisted';
|
|
18
19
|
import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
|
|
19
20
|
|
|
20
21
|
function BlogPostPageContent({
|
|
@@ -25,7 +26,7 @@ function BlogPostPageContent({
|
|
|
25
26
|
children: ReactNode;
|
|
26
27
|
}): JSX.Element {
|
|
27
28
|
const {metadata, toc} = useBlogPost();
|
|
28
|
-
const {nextItem, prevItem, frontMatter} = metadata;
|
|
29
|
+
const {nextItem, prevItem, frontMatter, unlisted} = metadata;
|
|
29
30
|
const {
|
|
30
31
|
hide_table_of_contents: hideTableOfContents,
|
|
31
32
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
@@ -43,6 +44,7 @@ function BlogPostPageContent({
|
|
|
43
44
|
/>
|
|
44
45
|
) : undefined
|
|
45
46
|
}>
|
|
47
|
+
{unlisted && <Unlisted />}
|
|
46
48
|
<BlogPostItem>{children}</BlogPostItem>
|
|
47
49
|
|
|
48
50
|
{(nextItem || prevItem) && (
|
|
@@ -9,11 +9,13 @@ import React from 'react';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import Link from '@docusaurus/Link';
|
|
11
11
|
import {translate} from '@docusaurus/Translate';
|
|
12
|
+
import {useVisibleBlogSidebarItems} from '@docusaurus/theme-common/internal';
|
|
12
13
|
import type {Props} from '@theme/BlogSidebar/Desktop';
|
|
13
14
|
|
|
14
15
|
import styles from './styles.module.css';
|
|
15
16
|
|
|
16
17
|
export default function BlogSidebarDesktop({sidebar}: Props): JSX.Element {
|
|
18
|
+
const items = useVisibleBlogSidebarItems(sidebar.items);
|
|
17
19
|
return (
|
|
18
20
|
<aside className="col col--3">
|
|
19
21
|
<nav
|
|
@@ -27,7 +29,7 @@ export default function BlogSidebarDesktop({sidebar}: Props): JSX.Element {
|
|
|
27
29
|
{sidebar.title}
|
|
28
30
|
</div>
|
|
29
31
|
<ul className={clsx(styles.sidebarItemList, 'clean-list')}>
|
|
30
|
-
{
|
|
32
|
+
{items.map((item) => (
|
|
31
33
|
<li key={item.permalink} className={styles.sidebarItem}>
|
|
32
34
|
<Link
|
|
33
35
|
isNavLink
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Link from '@docusaurus/Link';
|
|
10
|
+
import {useVisibleBlogSidebarItems} from '@docusaurus/theme-common/internal';
|
|
10
11
|
import {NavbarSecondaryMenuFiller} from '@docusaurus/theme-common';
|
|
11
12
|
import type {Props} from '@theme/BlogSidebar/Mobile';
|
|
12
13
|
|
|
13
14
|
function BlogSidebarMobileSecondaryMenu({sidebar}: Props): JSX.Element {
|
|
15
|
+
const items = useVisibleBlogSidebarItems(sidebar.items);
|
|
14
16
|
return (
|
|
15
17
|
<ul className="menu__list">
|
|
16
|
-
{
|
|
18
|
+
{items.map((item) => (
|
|
17
19
|
<li key={item.permalink} className="menu__list-item">
|
|
18
20
|
<Link
|
|
19
21
|
isNavLink
|
|
@@ -20,6 +20,7 @@ import BlogListPaginator from '@theme/BlogListPaginator';
|
|
|
20
20
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
21
21
|
import type {Props} from '@theme/BlogTagsPostsPage';
|
|
22
22
|
import BlogPostItems from '@theme/BlogPostItems';
|
|
23
|
+
import Unlisted from '@theme/Unlisted';
|
|
23
24
|
|
|
24
25
|
// Very simple pluralization: probably good enough for now
|
|
25
26
|
function useBlogPostsPlural() {
|
|
@@ -70,9 +71,9 @@ function BlogTagsPostsPageContent({
|
|
|
70
71
|
const title = useBlogTagsPostsPageTitle(tag);
|
|
71
72
|
return (
|
|
72
73
|
<BlogLayout sidebar={sidebar}>
|
|
74
|
+
{tag.unlisted && <Unlisted />}
|
|
73
75
|
<header className="margin-bottom--xl">
|
|
74
76
|
<h1>{title}</h1>
|
|
75
|
-
|
|
76
77
|
<Link href={tag.allTagsPath}>
|
|
77
78
|
<Translate
|
|
78
79
|
id="theme.tags.tagsPageLink"
|
|
@@ -123,13 +123,17 @@ export default function DocBreadcrumbs(): JSX.Element | null {
|
|
|
123
123
|
{homePageRoute && <HomeBreadcrumbItem />}
|
|
124
124
|
{breadcrumbs.map((item, idx) => {
|
|
125
125
|
const isLast = idx === breadcrumbs.length - 1;
|
|
126
|
+
const href =
|
|
127
|
+
item.type === 'category' && item.linkUnlisted
|
|
128
|
+
? undefined
|
|
129
|
+
: item.href;
|
|
126
130
|
return (
|
|
127
131
|
<BreadcrumbsItem
|
|
128
132
|
key={idx}
|
|
129
133
|
active={isLast}
|
|
130
134
|
index={idx}
|
|
131
|
-
addMicrodata={!!
|
|
132
|
-
<BreadcrumbsItemLink href={
|
|
135
|
+
addMicrodata={!!href}>
|
|
136
|
+
<BreadcrumbsItemLink href={href} isLast={isLast}>
|
|
133
137
|
{item.label}
|
|
134
138
|
</BreadcrumbsItemLink>
|
|
135
139
|
</BreadcrumbsItem>
|
|
@@ -17,6 +17,7 @@ import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
|
|
|
17
17
|
import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
|
|
18
18
|
import DocItemContent from '@theme/DocItem/Content';
|
|
19
19
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
20
|
+
import Unlisted from '@theme/Unlisted';
|
|
20
21
|
import type {Props} from '@theme/DocItem/Layout';
|
|
21
22
|
|
|
22
23
|
import styles from './styles.module.css';
|
|
@@ -47,9 +48,13 @@ function useDocTOC() {
|
|
|
47
48
|
|
|
48
49
|
export default function DocItemLayout({children}: Props): JSX.Element {
|
|
49
50
|
const docTOC = useDocTOC();
|
|
51
|
+
const {
|
|
52
|
+
metadata: {unlisted},
|
|
53
|
+
} = useDoc();
|
|
50
54
|
return (
|
|
51
55
|
<div className="row">
|
|
52
56
|
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
|
|
57
|
+
{unlisted && <Unlisted />}
|
|
53
58
|
<DocVersionBanner />
|
|
54
59
|
<div className={styles.docItemContainer}>
|
|
55
60
|
<article>
|
|
@@ -59,7 +59,7 @@ function useCategoryHrefWithSSRFallback(
|
|
|
59
59
|
): string | undefined {
|
|
60
60
|
const isBrowser = useIsBrowser();
|
|
61
61
|
return useMemo(() => {
|
|
62
|
-
if (item.href) {
|
|
62
|
+
if (item.href && !item.linkUnlisted) {
|
|
63
63
|
return item.href;
|
|
64
64
|
}
|
|
65
65
|
// In these cases, it's not necessary to render a fallback
|
|
@@ -6,17 +6,19 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React, {memo} from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
DocSidebarItemsExpandedStateProvider,
|
|
11
|
+
useVisibleSidebarItems,
|
|
12
|
+
} from '@docusaurus/theme-common/internal';
|
|
10
13
|
import DocSidebarItem from '@theme/DocSidebarItem';
|
|
11
14
|
|
|
12
15
|
import type {Props} from '@theme/DocSidebarItems';
|
|
13
16
|
|
|
14
|
-
// TODO this item should probably not receive the "activePath" props
|
|
15
|
-
// TODO this triggers whole sidebar re-renders on navigation
|
|
16
17
|
function DocSidebarItems({items, ...props}: Props): JSX.Element {
|
|
18
|
+
const visibleItems = useVisibleSidebarItems(items, props.activePath);
|
|
17
19
|
return (
|
|
18
20
|
<DocSidebarItemsExpandedStateProvider>
|
|
19
|
-
{
|
|
21
|
+
{visibleItems.map((item, index) => (
|
|
20
22
|
<DocSidebarItem key={index} item={item} index={index} {...props} />
|
|
21
23
|
))}
|
|
22
24
|
</DocSidebarItemsExpandedStateProvider>
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
18
18
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
19
19
|
import type {Props} from '@theme/DocTagDocListPage';
|
|
20
|
+
import Unlisted from '@theme/Unlisted';
|
|
20
21
|
|
|
21
22
|
// Very simple pluralization: probably good enough for now
|
|
22
23
|
function useNDocsTaggedPlural() {
|
|
@@ -80,6 +81,7 @@ function DocTagDocListPageContent({
|
|
|
80
81
|
<div className="container margin-vert--lg">
|
|
81
82
|
<div className="row">
|
|
82
83
|
<main className="col col--8 col--offset-2">
|
|
84
|
+
{tag.unlisted && <Unlisted />}
|
|
83
85
|
<header className="margin-bottom--xl">
|
|
84
86
|
<h1>{title}</h1>
|
|
85
87
|
<Link href={tag.allTagsPath}>
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import Layout from '@theme/Layout';
|
|
16
16
|
import MDXContent from '@theme/MDXContent';
|
|
17
17
|
import TOC from '@theme/TOC';
|
|
18
|
+
import Unlisted from '@theme/Unlisted';
|
|
18
19
|
import type {Props} from '@theme/MDXPage';
|
|
19
20
|
|
|
20
21
|
import styles from './styles.module.css';
|
|
@@ -22,7 +23,7 @@ import styles from './styles.module.css';
|
|
|
22
23
|
export default function MDXPage(props: Props): JSX.Element {
|
|
23
24
|
const {content: MDXPageContent} = props;
|
|
24
25
|
const {
|
|
25
|
-
metadata: {title, description, frontMatter},
|
|
26
|
+
metadata: {title, description, frontMatter, unlisted},
|
|
26
27
|
} = MDXPageContent;
|
|
27
28
|
const {wrapperClassName, hide_table_of_contents: hideTableOfContents} =
|
|
28
29
|
frontMatter;
|
|
@@ -38,6 +39,7 @@ export default function MDXPage(props: Props): JSX.Element {
|
|
|
38
39
|
<main className="container container--fluid margin-vert--lg">
|
|
39
40
|
<div className={clsx('row', styles.mdxPageWrapper)}>
|
|
40
41
|
<div className={clsx('col', !hideTableOfContents && 'col--8')}>
|
|
42
|
+
{unlisted && <Unlisted />}
|
|
41
43
|
<article>
|
|
42
44
|
<MDXContent>
|
|
43
45
|
<MDXPageContent />
|
|
@@ -19,9 +19,10 @@ export default function DocNavbarItem({
|
|
|
19
19
|
}: Props): JSX.Element | null {
|
|
20
20
|
const {activeDoc} = useActiveDocContext(docsPluginId);
|
|
21
21
|
const doc = useLayoutDoc(docId, docsPluginId);
|
|
22
|
+
const pageActive = activeDoc?.path === doc?.path;
|
|
22
23
|
|
|
23
|
-
// Draft items are not displayed in the navbar.
|
|
24
|
-
if (doc === null) {
|
|
24
|
+
// Draft and unlisted items are not displayed in the navbar.
|
|
25
|
+
if (doc === null || (doc.unlisted && !pageActive)) {
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -30,7 +31,7 @@ export default function DocNavbarItem({
|
|
|
30
31
|
exact
|
|
31
32
|
{...props}
|
|
32
33
|
isActive={() =>
|
|
33
|
-
|
|
34
|
+
pageActive ||
|
|
34
35
|
(!!activeDoc?.sidebar && activeDoc.sidebar === doc.sidebar)
|
|
35
36
|
}
|
|
36
37
|
label={staticLabel ?? doc.id}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {
|
|
11
|
+
ThemeClassNames,
|
|
12
|
+
UnlistedBannerTitle,
|
|
13
|
+
UnlistedBannerMessage,
|
|
14
|
+
UnlistedMetadata,
|
|
15
|
+
} from '@docusaurus/theme-common';
|
|
16
|
+
import Admonition from '@theme/Admonition';
|
|
17
|
+
import type {Props} from '@theme/Unlisted';
|
|
18
|
+
|
|
19
|
+
function UnlistedBanner({className}: Props) {
|
|
20
|
+
return (
|
|
21
|
+
<Admonition
|
|
22
|
+
type="caution"
|
|
23
|
+
title={<UnlistedBannerTitle />}
|
|
24
|
+
className={clsx(className, ThemeClassNames.common.unlistedBanner)}>
|
|
25
|
+
<UnlistedBannerMessage />
|
|
26
|
+
</Admonition>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function Unlisted(props: Props): JSX.Element | null {
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
{/*
|
|
34
|
+
Unlisted metadata declared here for simplicity.
|
|
35
|
+
Ensures we never forget to add the correct noindex metadata.
|
|
36
|
+
Also gives a central place for user to swizzle override default metadata.
|
|
37
|
+
*/}
|
|
38
|
+
<UnlistedMetadata />
|
|
39
|
+
<UnlistedBanner {...props} />
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
}
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -1494,6 +1494,14 @@ declare module '@theme/Tag' {
|
|
|
1494
1494
|
export default function Tag(props: Props): JSX.Element;
|
|
1495
1495
|
}
|
|
1496
1496
|
|
|
1497
|
+
declare module '@theme/Unlisted' {
|
|
1498
|
+
export interface Props {
|
|
1499
|
+
className?: string;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
export default function Unlisted(props: Props): JSX.Element;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1497
1505
|
declare module '@theme/prism-include-languages' {
|
|
1498
1506
|
import type * as PrismNamespace from 'prismjs';
|
|
1499
1507
|
|