This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch build-community
in repository https://gitbox.apache.org/repos/asf/incubator-answer-website.git

commit 17633de96045675340a9a36f876381dd8deb8209
Author: shuai <[email protected]>
AuthorDate: Tue Nov 28 11:57:36 2023 +0800

    fix: upgrade docusaurus v3.0
---
 .../index.md                                       |  2 +-
 community/about.md                                 |  6 +-
 community/contributing/how-to-release.md           |  4 +-
 community/support.mdx                              |  1 +
 .../index.md                                       |  2 +-
 src/theme/DocBreadcrumbs/index.tsx                 |  8 +-
 src/theme/DocCard/index.tsx                        | 17 ++--
 src/theme/DocItem/Layout/index.tsx                 |  5 ++
 src/theme/DocItem/index.tsx                        |  2 +-
 src/theme/DocSidebarItem/Category/index.tsx        | 37 +++++---
 src/theme/DocSidebarItems/index.tsx                | 10 ++-
 src/theme/DocTagDocListPage/index.tsx              | 99 +++++++++++++---------
 src/theme/DocTagsListPage/index.tsx                | 50 +++++++----
 .../DocVersionBadge/DocTagsListPage/index.tsx      | 59 +++++++++++++
 14 files changed, 214 insertions(+), 88 deletions(-)

diff --git 
a/blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md 
b/blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md
index 67509785..17c45d9c 100644
--- a/blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md
+++ b/blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md
@@ -44,7 +44,7 @@ In Answer, tag is a thread that connects users, content, and 
moderator. With mor
 Moderator can group related posts together and help organize content based on 
specific topics, themes, or categories.
 
 ![Game Community Built with Answer](OrganizeContent1.png)
-[![Support Community Built with 
Answer](OrganizeContent2.png)](../2023-07-05-how-to-build-a-help-center-with-your-users-and-answer/index.md)
+[![Support Community Built with 
Answer](OrganizeContent2.png)](/blog/2023/07/05/how-to-build-a-help-center-with-your-users-and-answer)
 
 2. Quick Search
 Tags make content more discoverable. In Answer, users can search for specific 
tags to find relevant content they are looking for.
diff --git a/community/about.md b/community/about.md
index 55418540..8d6691c0 100644
--- a/community/about.md
+++ b/community/about.md
@@ -33,6 +33,6 @@ While committers on a project have the ability to update the 
code, only the PMC
 
 ## Reference
 
-- <https://community.apache.org/contributors>
-- <https://community.apache.org/contributors/becomingacommitter.html>
-- <https://www.apache.org/dev/pmc.html>
+- https://community.apache.org/contributors
+- https://community.apache.org/contributors/becomingacommitter.html
+- https://www.apache.org/dev/pmc.html
diff --git a/community/contributing/how-to-release.md 
b/community/contributing/how-to-release.md
index 6670f42e..15f939ec 100644
--- a/community/contributing/how-to-release.md
+++ b/community/contributing/how-to-release.md
@@ -67,10 +67,10 @@ $ for i in *.tar.gz; do echo $i; sha512sum --check  
$i.sha512; done
 
 ## Vote on the release
 
-1. Send a vote email to the <[email protected]>. Incubator need to first 
do a vote on their dev list and that vote requires at least **3 +1s from Answer 
PPMC members**.
+1. Send a vote email to the [email protected]. Incubator need to first do 
a vote on their dev list and that vote requires at least **3 +1s from Answer 
PPMC members**.
 2. Wait for at **least 72 hours** or until the necessary number of votes are 
reached.
 3. Announce the result of the vote on the dev list.
-4. If the dev vote passes, send email to the <[email protected]> to 
request a vote on the general list. The incubator vote needs at least **3 +1s 
from Incubator PMC members**
+4. If the dev vote passes, send email to the [email protected] to 
request a vote on the general list. The incubator vote needs at least **3 +1s 
from Incubator PMC members**
    (binding votes).
 5. Wait for at **least 72 hours** or until the necessary number of votes are 
reached.
 6. Announce the result of the vote on the dev list.
diff --git a/community/support.mdx b/community/support.mdx
index 5fd05127..c9fc1568 100644
--- a/community/support.mdx
+++ b/community/support.mdx
@@ -34,6 +34,7 @@ For the latest news about Answer, [follow @answerdev on 
Twitter](https://twitter
 If you don't find what you're looking for, please use the form below to submit 
your request. We'll try and get back to you as soon as possible.
 
 import HubspotForm from 'react-hubspot-form';
+import Translate from '@docusaurus/Translate';
 import { Spinner } from 'react-bootstrap';
 
   <HubspotForm
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md
 
b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md
index 67509785..17c45d9c 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-11-the-what-why-using-tags-for-online-community/index.md
@@ -44,7 +44,7 @@ In Answer, tag is a thread that connects users, content, and 
moderator. With mor
 Moderator can group related posts together and help organize content based on 
specific topics, themes, or categories.
 
 ![Game Community Built with Answer](OrganizeContent1.png)
-[![Support Community Built with 
Answer](OrganizeContent2.png)](../2023-07-05-how-to-build-a-help-center-with-your-users-and-answer/index.md)
+[![Support Community Built with 
Answer](OrganizeContent2.png)](/blog/2023/07/05/how-to-build-a-help-center-with-your-users-and-answer)
 
 2. Quick Search
 Tags make content more discoverable. In Answer, users can search for specific 
tags to find relevant content they are looking for.
diff --git a/src/theme/DocBreadcrumbs/index.tsx 
b/src/theme/DocBreadcrumbs/index.tsx
index 74e02efd..a0e4ec32 100644
--- a/src/theme/DocBreadcrumbs/index.tsx
+++ b/src/theme/DocBreadcrumbs/index.tsx
@@ -104,13 +104,17 @@ export default function DocBreadcrumbs(): JSX.Element | 
null {
         {homePageRoute && <HomeBreadcrumbItem />}
         {breadcrumbs.map((item, idx) => {
           const isLast = idx === breadcrumbs.length - 1;
+          const href =
+            item.type === 'category' && item.linkUnlisted
+              ? undefined
+              : item.href;
           return (
             <BreadcrumbsItem
               key={idx}
               active={isLast}
               index={idx}
-              addMicrodata={!!item.href}>
-              <BreadcrumbsItemLink href={item.href} isLast={isLast}>
+              addMicrodata={!!href}>
+              <BreadcrumbsItemLink href={href} isLast={isLast}>
                 {item.label}
               </BreadcrumbsItemLink>
             </BreadcrumbsItem>
diff --git a/src/theme/DocCard/index.tsx b/src/theme/DocCard/index.tsx
index 82d45987..9e1b190d 100644
--- a/src/theme/DocCard/index.tsx
+++ b/src/theme/DocCard/index.tsx
@@ -9,19 +9,21 @@ import React, {type ReactNode} from 'react';
 import clsx from 'clsx';
 import Link from '@docusaurus/Link';
 import {
-  findFirstCategoryLink,
+  findFirstSidebarItemLink,
   useDocById,
 } from '@docusaurus/theme-common/internal';
 import isInternalUrl from '@docusaurus/isInternalUrl';
 import {translate} from '@docusaurus/Translate';
-import type {Props} from '@theme/DocCard';
 
-import styles from './styles.module.css';
+import type {Props} from '@theme/DocCard';
+import Heading from '@theme/Heading';
 import type {
   PropSidebarItemCategory,
   PropSidebarItemLink,
 } from '@docusaurus/plugin-content-docs';
 
+import styles from './styles.module.css';
+
 function CardContainer({
   href,
   children,
@@ -51,9 +53,12 @@ function CardLayout({
 }): JSX.Element {
   return (
     <CardContainer href={href}>
-      <h2 className={clsx('text--truncate', styles.cardTitle)} title={title}>
+      <Heading
+        as="h2"
+        className={clsx('text--truncate', styles.cardTitle)}
+        title={title}>
         {icon} {title}
-      </h2>
+      </Heading>
       {description && (
         <p
           className={clsx('text--truncate', styles.cardDescription)}
@@ -70,7 +75,7 @@ function CardCategory({
 }: {
   item: PropSidebarItemCategory;
 }): JSX.Element | null {
-  const href = findFirstCategoryLink(item);
+  const href = findFirstSidebarItemLink(item);
 
   // Unexpected: categories that don't have a link have been filtered upfront
   if (!href) {
diff --git a/src/theme/DocItem/Layout/index.tsx 
b/src/theme/DocItem/Layout/index.tsx
index ff5ab6d1..9c46677c 100644
--- a/src/theme/DocItem/Layout/index.tsx
+++ b/src/theme/DocItem/Layout/index.tsx
@@ -17,6 +17,7 @@ import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
 import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
 import DocItemContent from '@theme/DocItem/Content';
 import DocBreadcrumbs from '@theme/DocBreadcrumbs';
+import Unlisted from '@theme/Unlisted';
 import type {Props} from '@theme/DocItem/Layout';
 
 import styles from './styles.module.css';
@@ -47,9 +48,13 @@ function useDocTOC() {
 
 export default function DocItemLayout({children}: Props): JSX.Element {
   const docTOC = useDocTOC();
+  const {
+    metadata: {unlisted},
+  } = useDoc();
   return (
     <div className="row">
       <div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
+        {unlisted && <Unlisted />}
         <DocVersionBanner />
         <div className={styles.docItemContainer}>
           <article>
diff --git a/src/theme/DocItem/index.tsx b/src/theme/DocItem/index.tsx
index e4b0c7cf..3bde2a0c 100644
--- a/src/theme/DocItem/index.tsx
+++ b/src/theme/DocItem/index.tsx
@@ -13,7 +13,7 @@ import DocItemLayout from '@theme/DocItem/Layout';
 import type {Props} from '@theme/DocItem';
 
 export default function DocItem(props: Props): JSX.Element {
-  const docHtmlClassName = 
`docs-doc-id-${props.content.metadata.unversionedId}`;
+  const docHtmlClassName = `docs-doc-id-${props.content.metadata.id}`;
   const MDXComponent = props.content;
   return (
     <DocProvider content={props.content}>
diff --git a/src/theme/DocSidebarItem/Category/index.tsx 
b/src/theme/DocSidebarItem/Category/index.tsx
index 700c4a52..8890a804 100644
--- a/src/theme/DocSidebarItem/Category/index.tsx
+++ b/src/theme/DocSidebarItem/Category/index.tsx
@@ -16,7 +16,7 @@ import {
 } from '@docusaurus/theme-common';
 import {
   isActiveSidebarItem,
-  findFirstCategoryLink,
+  findFirstSidebarItemLink,
   useDocSidebarItemsExpandedState,
   isSamePath,
 } from '@docusaurus/theme-common/internal';
@@ -59,7 +59,7 @@ function useCategoryHrefWithSSRFallback(
 ): string | undefined {
   const isBrowser = useIsBrowser();
   return useMemo(() => {
-    if (item.href) {
+    if (item.href && !item.linkUnlisted) {
       return item.href;
     }
     // In these cases, it's not necessary to render a fallback
@@ -67,28 +67,40 @@ function useCategoryHrefWithSSRFallback(
     if (isBrowser || !item.collapsible) {
       return undefined;
     }
-    return findFirstCategoryLink(item);
+    return findFirstSidebarItemLink(item);
   }, [item, isBrowser]);
 }
 
 function CollapseButton({
+  collapsed,
   categoryLabel,
   onClick,
 }: {
+  collapsed: boolean;
   categoryLabel: string;
   onClick: ComponentProps<'button'>['onClick'];
 }) {
   return (
     <button
-      aria-label={translate(
-        {
-          id: 'theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel',
-          message: "Toggle the collapsible sidebar category '{label}'",
-          description:
-            'The ARIA label to toggle the collapsible sidebar category',
-        },
-        {label: categoryLabel},
-      )}
+      aria-label={
+        collapsed
+          ? translate(
+              {
+                id: 'theme.DocSidebarItem.expandCategoryAriaLabel',
+                message: "Expand sidebar category '{label}'",
+                description: 'The ARIA label to expand the sidebar category',
+              },
+              {label: categoryLabel},
+            )
+          : translate(
+              {
+                id: 'theme.DocSidebarItem.collapseCategoryAriaLabel',
+                message: "Collapse sidebar category '{label}'",
+                description: 'The ARIA label to collapse the sidebar category',
+              },
+              {label: categoryLabel},
+            )
+      }
       type="button"
       className="clean-btn menu__caret"
       onClick={onClick}
@@ -188,6 +200,7 @@ export default function DocSidebarItemCategory({
         </Link>
         {href && collapsible && (
           <CollapseButton
+            collapsed={collapsed}
             categoryLabel={label}
             onClick={(e) => {
               e.preventDefault();
diff --git a/src/theme/DocSidebarItems/index.tsx 
b/src/theme/DocSidebarItems/index.tsx
index 84060b91..cf59b208 100644
--- a/src/theme/DocSidebarItems/index.tsx
+++ b/src/theme/DocSidebarItems/index.tsx
@@ -6,17 +6,19 @@
  */
 
 import React, {memo} from 'react';
-import {DocSidebarItemsExpandedStateProvider} from 
'@docusaurus/theme-common/internal';
+import {
+  DocSidebarItemsExpandedStateProvider,
+  useVisibleSidebarItems,
+} from '@docusaurus/theme-common/internal';
 import DocSidebarItem from '@theme/DocSidebarItem';
 
 import type {Props} from '@theme/DocSidebarItems';
 
-// TODO this item should probably not receive the "activePath" props
-// TODO this triggers whole sidebar re-renders on navigation
 function DocSidebarItems({items, ...props}: Props): JSX.Element {
+  const visibleItems = useVisibleSidebarItems(items, props.activePath);
   return (
     <DocSidebarItemsExpandedStateProvider>
-      {items.map((item, index) => (
+      {visibleItems.map((item, index) => (
         <DocSidebarItem key={index} item={item} index={index} {...props} />
       ))}
     </DocSidebarItemsExpandedStateProvider>
diff --git a/src/theme/DocTagDocListPage/index.tsx 
b/src/theme/DocTagDocListPage/index.tsx
index a928644a..aa90c75a 100644
--- a/src/theme/DocTagDocListPage/index.tsx
+++ b/src/theme/DocTagDocListPage/index.tsx
@@ -15,9 +15,10 @@ import {
   usePluralForm,
 } from '@docusaurus/theme-common';
 import Translate, {translate} from '@docusaurus/Translate';
-import Layout from '@theme/Layout';
 import SearchMetadata from '@theme/SearchMetadata';
 import type {Props} from '@theme/DocTagDocListPage';
+import Unlisted from '@theme/Unlisted';
+import Heading from '@theme/Heading';
 
 // Very simple pluralization: probably good enough for now
 function useNDocsTaggedPlural() {
@@ -37,59 +38,79 @@ function useNDocsTaggedPlural() {
     );
 }
 
+function usePageTitle(props: Props): string {
+  const nDocsTaggedPlural = useNDocsTaggedPlural();
+  return translate(
+    {
+      id: 'theme.docs.tagDocListPageTitle',
+      description: 'The title of the page for a docs tag',
+      message: '{nDocsTagged} with "{tagName}"',
+    },
+    {nDocsTagged: nDocsTaggedPlural(props.tag.count), tagName: 
props.tag.label},
+  );
+}
+
 function DocItem({doc}: {doc: Props['tag']['items'][number]}): JSX.Element {
   return (
     <article className="margin-vert--lg">
       <Link to={doc.permalink}>
-        <h2>{doc.title}</h2>
+        <Heading as="h2">{doc.title}</Heading>
       </Link>
       {doc.description && <p>{doc.description}</p>}
     </article>
   );
 }
 
-export default function DocTagDocListPage({tag}: Props): JSX.Element {
-  const nDocsTaggedPlural = useNDocsTaggedPlural();
-  const title = translate(
-    {
-      id: 'theme.docs.tagDocListPageTitle',
-      description: 'The title of the page for a docs tag',
-      message: '{nDocsTagged} with "{tagName}"',
-    },
-    {nDocsTagged: nDocsTaggedPlural(tag.count), tagName: tag.label},
+function DocTagDocListPageMetadata({
+  title,
+}: Props & {title: string}): JSX.Element {
+  return (
+    <>
+      <PageMetadata title={title} />
+      <SearchMetadata tag="doc_tag_doc_list" />
+    </>
   );
+}
 
+function DocTagDocListPageContent({
+  tag,
+  title,
+}: Props & {title: string}): JSX.Element {
   return (
     <HtmlClassNameProvider
-      className={clsx(
-        ThemeClassNames.wrapper.docsPages,
-        ThemeClassNames.page.docsTagDocListPage,
-      )}>
-      <PageMetadata title={title} />
-      <SearchMetadata tag="doc_tag_doc_list" />
-      <Layout>
-        <div className="container margin-vert--lg">
-          <div className="row">
-            <main className="col col--8 col--offset-2">
-              <header className="margin-bottom--xl">
-                <h1>{title}</h1>
-                <Link href={tag.allTagsPath}>
-                  <Translate
-                    id="theme.tags.tagsPageLink"
-                    description="The label of the link targeting the tag list 
page">
-                    View All Tags
-                  </Translate>
-                </Link>
-              </header>
-              <section className="margin-vert--lg">
-                {tag.items.map((doc) => (
-                  <DocItem key={doc.id} doc={doc} />
-                ))}
-              </section>
-            </main>
-          </div>
+      className={clsx(ThemeClassNames.page.docsTagDocListPage)}>
+      <div className="container margin-vert--lg">
+        <div className="row">
+          <main className="col col--8 col--offset-2">
+            {tag.unlisted && <Unlisted />}
+            <header className="margin-bottom--xl">
+              <Heading as="h1">{title}</Heading>
+              <Link href={tag.allTagsPath}>
+                <Translate
+                  id="theme.tags.tagsPageLink"
+                  description="The label of the link targeting the tag list 
page">
+                  View All Tags
+                </Translate>
+              </Link>
+            </header>
+            <section className="margin-vert--lg">
+              {tag.items.map((doc) => (
+                <DocItem key={doc.id} doc={doc} />
+              ))}
+            </section>
+          </main>
         </div>
-      </Layout>
+      </div>
     </HtmlClassNameProvider>
   );
 }
+
+export default function DocTagDocListPage(props: Props): JSX.Element {
+  const title = usePageTitle(props);
+  return (
+    <>
+      <DocTagDocListPageMetadata {...props} title={title} />
+      <DocTagDocListPageContent {...props} title={title} />
+    </>
+  );
+}
diff --git a/src/theme/DocTagsListPage/index.tsx 
b/src/theme/DocTagsListPage/index.tsx
index e848128f..4a5af782 100644
--- a/src/theme/DocTagsListPage/index.tsx
+++ b/src/theme/DocTagsListPage/index.tsx
@@ -13,31 +13,47 @@ import {
   ThemeClassNames,
   translateTagsPageTitle,
 } from '@docusaurus/theme-common';
-import Layout from '@theme/Layout';
 import TagsListByLetter from '@theme/TagsListByLetter';
 import SearchMetadata from '@theme/SearchMetadata';
 import type {Props} from '@theme/DocTagsListPage';
+import Heading from '@theme/Heading';
 
-export default function DocTagsListPage({tags}: Props): JSX.Element {
-  const title = translateTagsPageTitle();
+function DocTagsListPageMetadata({
+  title,
+}: Props & {title: string}): JSX.Element {
   return (
-    <HtmlClassNameProvider
-      className={clsx(
-        ThemeClassNames.wrapper.docsPages,
-        ThemeClassNames.page.docsTagsListPage,
-      )}>
+    <>
       <PageMetadata title={title} />
       <SearchMetadata tag="doc_tags_list" />
-      <Layout>
-        <div className="container margin-vert--lg">
-          <div className="row">
-            <main className="col col--8 col--offset-2">
-              <h1>{title}</h1>
-              <TagsListByLetter tags={tags} />
-            </main>
-          </div>
+    </>
+  );
+}
+
+function DocTagsListPageContent({
+  tags,
+  title,
+}: Props & {title: string}): JSX.Element {
+  return (
+    <HtmlClassNameProvider
+      className={clsx(ThemeClassNames.page.docsTagsListPage)}>
+      <div className="container margin-vert--lg">
+        <div className="row">
+          <main className="col col--8 col--offset-2">
+            <Heading as="h1">{title}</Heading>
+            <TagsListByLetter tags={tags} />
+          </main>
         </div>
-      </Layout>
+      </div>
     </HtmlClassNameProvider>
   );
 }
+
+export default function DocTagsListPage(props: Props): JSX.Element {
+  const title = translateTagsPageTitle();
+  return (
+    <>
+      <DocTagsListPageMetadata {...props} title={title} />
+      <DocTagsListPageContent {...props} title={title} />
+    </>
+  );
+}
diff --git a/src/theme/DocVersionBadge/DocTagsListPage/index.tsx 
b/src/theme/DocVersionBadge/DocTagsListPage/index.tsx
new file mode 100644
index 00000000..4a5af782
--- /dev/null
+++ b/src/theme/DocVersionBadge/DocTagsListPage/index.tsx
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import React from 'react';
+import clsx from 'clsx';
+import {
+  PageMetadata,
+  HtmlClassNameProvider,
+  ThemeClassNames,
+  translateTagsPageTitle,
+} from '@docusaurus/theme-common';
+import TagsListByLetter from '@theme/TagsListByLetter';
+import SearchMetadata from '@theme/SearchMetadata';
+import type {Props} from '@theme/DocTagsListPage';
+import Heading from '@theme/Heading';
+
+function DocTagsListPageMetadata({
+  title,
+}: Props & {title: string}): JSX.Element {
+  return (
+    <>
+      <PageMetadata title={title} />
+      <SearchMetadata tag="doc_tags_list" />
+    </>
+  );
+}
+
+function DocTagsListPageContent({
+  tags,
+  title,
+}: Props & {title: string}): JSX.Element {
+  return (
+    <HtmlClassNameProvider
+      className={clsx(ThemeClassNames.page.docsTagsListPage)}>
+      <div className="container margin-vert--lg">
+        <div className="row">
+          <main className="col col--8 col--offset-2">
+            <Heading as="h1">{title}</Heading>
+            <TagsListByLetter tags={tags} />
+          </main>
+        </div>
+      </div>
+    </HtmlClassNameProvider>
+  );
+}
+
+export default function DocTagsListPage(props: Props): JSX.Element {
+  const title = translateTagsPageTitle();
+  return (
+    <>
+      <DocTagsListPageMetadata {...props} title={title} />
+      <DocTagsListPageContent {...props} title={title} />
+    </>
+  );
+}

Reply via email to