This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-website.git
The following commit(s) were added to refs/heads/master by this push: new 55b53c5 fix: Sync Docs action issue and other issues (#203) 55b53c5 is described below commit 55b53c5d0a5e91823b230458a58767aab2f40bdf Author: qier222 <qier...@outlook.com> AuthorDate: Thu Feb 25 13:19:47 2021 +0800 fix: Sync Docs action issue and other issues (#203) --- .github/workflows/updateDocs.yaml | 9 +- website/docusaurus.config.js | 7 +- .../current.json | 10 -- .../current.json | 10 -- .../version-2.3.json | 10 -- .../current.json | 0 .../current.json | 10 ++ .../current.json | 0 .../zh/docusaurus-plugin-content-docs/current.json | 10 ++ .../docusaurus-theme-classic/footer.json | 2 +- .../docusaurus-theme-classic/navbar.json | 2 +- website/src/theme/DocPage/index.js | 149 +++++++++++++-------- website/src/theme/DocPage/styles.module.css | 4 +- website/src/theme/DocSidebar/styles.module.css | 22 +-- 14 files changed, 139 insertions(+), 106 deletions(-) diff --git a/.github/workflows/updateDocs.yaml b/.github/workflows/updateDocs.yaml index 1fcf32d..924174a 100644 --- a/.github/workflows/updateDocs.yaml +++ b/.github/workflows/updateDocs.yaml @@ -22,6 +22,9 @@ jobs: node pullDocs.js && git status - name: Add & Commit - uses: EndBug/add-and-commit@v7.0.0 - with: - message: "docs: update docs (by GitHub Action)" + run: | + git config user.name github-actions + git config user.email github-acti...@github.com + git add . + git commit -m "docs: update docs (by GitHub Action)" + git push diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 4660397..01af217 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -72,6 +72,7 @@ module.exports = { }, onBrokenLinks: "log", onBrokenMarkdownLinks: "log", + noIndex: true, presets: [ [ "@docusaurus/preset-classic", @@ -149,15 +150,15 @@ module.exports = { }, { label: "APISIX™️", - to: "/docs/apisix/test", + to: "/docs/apisix/introduction", }, { label: "APISIX™️ Dashboard", - to: "/docs/dashboard/test", + to: "/docs/dashboard/introduction", }, { label: "APISIX™️ Ingress Controller", - to: "/docs/ingress-controller/test", + to: "/docs/ingress-controller/install", }, ], }, diff --git a/website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current.json b/website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current.json deleted file mode 100644 index 725a1bb..0000000 --- a/website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version.label": { - "message": "Next", - "description": "The label for version current" - }, - "sidebar.docs.category.APISIX™️ Dashboard": { - "message": "APISIX™️ Dashboard", - "description": "The label for category APISIX™️ Dashboard in sidebar docs" - } -} diff --git a/website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current.json b/website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current.json deleted file mode 100644 index 725a1bb..0000000 --- a/website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version.label": { - "message": "Next", - "description": "The label for version current" - }, - "sidebar.docs.category.APISIX™️ Dashboard": { - "message": "APISIX™️ Dashboard", - "description": "The label for category APISIX™️ Dashboard in sidebar docs" - } -} diff --git a/website/i18n/zh-cn/docusaurus-plugin-content-docs/version-2.3.json b/website/i18n/zh-cn/docusaurus-plugin-content-docs/version-2.3.json deleted file mode 100644 index 80ddd0e..0000000 --- a/website/i18n/zh-cn/docusaurus-plugin-content-docs/version-2.3.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version.label": { - "message": "2.3", - "description": "The label for version 2.3" - }, - "sidebar.docs.category.APISIX™️": { - "message": "APISIX™️", - "description": "The label for category APISIX™️ in sidebar docs" - } -} \ No newline at end of file diff --git a/website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix/current.json b/website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix-dashboard/current.json similarity index 100% rename from website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix/current.json rename to website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix-dashboard/current.json diff --git a/website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current.json b/website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current.json new file mode 100644 index 0000000..5a24b65 --- /dev/null +++ b/website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current.json @@ -0,0 +1,10 @@ +{ + "version.label": { + "message": "Next", + "description": "The label for version current" + }, + "sidebar.docs.category.APISIX™️ Ingress Controller": { + "message": "APISIX™️ Ingress Controller", + "description": "The label for category APISIX™️ Ingress Controller in sidebar docs" + } +} diff --git a/website/i18n/zh-cn/docusaurus-plugin-content-docs/current.json b/website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix/current.json similarity index 100% rename from website/i18n/zh-cn/docusaurus-plugin-content-docs/current.json rename to website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix/current.json diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current.json b/website/i18n/zh/docusaurus-plugin-content-docs/current.json new file mode 100644 index 0000000..926a6f6 --- /dev/null +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current.json @@ -0,0 +1,10 @@ +{ + "version.label": { + "message": "Next", + "description": "The label for version current" + }, + "sidebar.docs.category.General": { + "message": "General", + "description": "The label for category General in sidebar docs" + } +} diff --git a/website/i18n/zh-cn/docusaurus-theme-classic/footer.json b/website/i18n/zh/docusaurus-theme-classic/footer.json similarity index 99% rename from website/i18n/zh-cn/docusaurus-theme-classic/footer.json rename to website/i18n/zh/docusaurus-theme-classic/footer.json index 81f6bdb..b022692 100644 --- a/website/i18n/zh-cn/docusaurus-theme-classic/footer.json +++ b/website/i18n/zh/docusaurus-theme-classic/footer.json @@ -55,4 +55,4 @@ "message": "Copyright © 2019-2021 The Apache Software Foundation. Apache APISIX, APISIX™, Apache, the Apache feather logo, and the Apache APISIX project logo are either registered trademarks or trademarks of the Apache Software Foundation.", "description": "The footer copyright" } -} \ No newline at end of file +} diff --git a/website/i18n/zh-cn/docusaurus-theme-classic/navbar.json b/website/i18n/zh/docusaurus-theme-classic/navbar.json similarity index 99% rename from website/i18n/zh-cn/docusaurus-theme-classic/navbar.json rename to website/i18n/zh/docusaurus-theme-classic/navbar.json index 2b17683..be4c500 100644 --- a/website/i18n/zh-cn/docusaurus-theme-classic/navbar.json +++ b/website/i18n/zh/docusaurus-theme-classic/navbar.json @@ -35,4 +35,4 @@ "message": "APISIX Dashboard", "description": "Navbar item with label APISIX Dashboard" } -} \ No newline at end of file +} diff --git a/website/src/theme/DocPage/index.js b/website/src/theme/DocPage/index.js index 82385e4..11ae324 100644 --- a/website/src/theme/DocPage/index.js +++ b/website/src/theme/DocPage/index.js @@ -4,34 +4,27 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import React, { useState, useCallback } from 'react'; -import { MDXProvider } from '@mdx-js/react'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import renderRoutes from '@docusaurus/renderRoutes'; -import Layout from '@theme/Layout'; -import DocSidebar from '@theme/DocSidebar'; -import MDXComponents from '@theme/MDXComponents'; -import NotFound from '@theme/NotFound'; -import IconArrow from '@theme/IconArrow'; -import { matchPath } from '@docusaurus/router'; -import clsx from 'clsx'; -import styles from './styles.module.css'; -import { docVersionSearchTag } from '@docusaurus/theme-common'; +import React, { useState, useCallback } from "react"; +import { MDXProvider } from "@mdx-js/react"; +import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; +import renderRoutes from "@docusaurus/renderRoutes"; +import Layout from "@theme/Layout"; +import DocSidebar from "@theme/DocSidebar"; +import MDXComponents from "@theme/MDXComponents"; +import NotFound from "@theme/NotFound"; +import IconArrow from "@theme/IconArrow"; +import { matchPath } from "@docusaurus/router"; +import clsx from "clsx"; +import styles from "./styles.module.css"; +import { docVersionSearchTag } from "@docusaurus/theme-common"; -function DocPageContent({ - currentDocRoute, - versionMetadata, - children -}) { - const { - siteConfig, - isClient - } = useDocusaurusContext(); +function DocPageContent({ currentDocRoute, versionMetadata, children }) { + const { siteConfig, isClient } = useDocusaurusContext(); const { pluginId, permalinkToSidebar, docsSidebars, - version + version, } = versionMetadata; const sidebarName = permalinkToSidebar[currentDocRoute.path]; const sidebar = docsSidebars[sidebarName]; @@ -44,58 +37,104 @@ function DocPageContent({ setHiddenSidebarContainer(!hiddenSidebarContainer); }, [hiddenSidebar]); - return <Layout key={isClient} searchMetadatas={{ - version, - tag: docVersionSearchTag(pluginId, version) - }}> + return ( + <Layout + key={isClient} + searchMetadatas={{ + version, + tag: docVersionSearchTag(pluginId, version), + }} + > <div className={styles.docPage}> - {sidebar && <div className={clsx(styles.docSidebarContainer, { - [styles.docSidebarContainerHidden]: hiddenSidebarContainer - })} onTransitionEnd={e => { - if (!e.currentTarget.classList.contains(styles.docSidebarContainer)) { - return; - } + {sidebar && ( + <div + className={clsx(styles.docSidebarContainer, { + [styles.docSidebarContainerHidden]: hiddenSidebarContainer, + })} + onTransitionEnd={(e) => { + if ( + !e.currentTarget.classList.contains(styles.docSidebarContainer) + ) { + return; + } - if (hiddenSidebarContainer) { - setHiddenSidebar(true); - } - }} role="complementary"> - <DocSidebar key={// Reset sidebar state on sidebar changes - // See https://github.com/facebook/docusaurus/issues/3414 - sidebarName} sidebar={sidebar} path={currentDocRoute.path} sidebarCollapsible={siteConfig.themeConfig?.sidebarCollapsible ?? true} onCollapse={toggleSidebar} isHidden={hiddenSidebar} docPluginId={pluginId} /> + if (hiddenSidebarContainer) { + setHiddenSidebar(true); + } + }} + role="complementary" + > + <DocSidebar + key={ + // Reset sidebar state on sidebar changes + // See https://github.com/facebook/docusaurus/issues/3414 + sidebarName + } + sidebar={sidebar} + path={currentDocRoute.path} + sidebarCollapsible={ + siteConfig.themeConfig?.sidebarCollapsible ?? true + } + onCollapse={toggleSidebar} + isHidden={hiddenSidebar} + docPluginId={pluginId} + /> - {hiddenSidebar && <div className={styles.collapsedDocSidebar} title="Expand sidebar" aria-label="Expand sidebar" tabIndex={0} role="button" onKeyDown={toggleSidebar} onClick={toggleSidebar}> + {hiddenSidebar && ( + <div + className={styles.collapsedDocSidebar} + title="Expand sidebar" + aria-label="Expand sidebar" + tabIndex={0} + role="button" + onKeyDown={toggleSidebar} + onClick={toggleSidebar} + > <IconArrow aria-label="Expand sidebar" /> - </div>} - </div>} + </div> + )} + </div> + )} <main className={styles.docMainContainer}> - <div className={clsx('container padding-vert--lg', styles.docItemWrapper, { - [styles.docItemWrapperEnhanced]: hiddenSidebarContainer - })}> + <div + className={clsx( + "container padding-vert--lg", + styles.docItemWrapper, + { + [styles.docItemWrapperEnhanced]: hiddenSidebarContainer, + } + )} + > <MDXProvider components={MDXComponents}>{children}</MDXProvider> </div> </main> </div> - </Layout>; + </Layout> + ); } function DocPage(props) { const { - route: { - routes: docRoutes - }, + route: { routes: docRoutes }, versionMetadata, - location + location, } = props; - const currentDocRoute = docRoutes.find(docRoute => matchPath(location.pathname, docRoute)); + const currentDocRoute = docRoutes.find((docRoute) => + matchPath(location.pathname, docRoute) + ); if (!currentDocRoute) { return <NotFound {...props} />; } - return <DocPageContent currentDocRoute={currentDocRoute} versionMetadata={versionMetadata}> + return ( + <DocPageContent + currentDocRoute={currentDocRoute} + versionMetadata={versionMetadata} + > {renderRoutes(docRoutes)} - </DocPageContent>; + </DocPageContent> + ); } -export default DocPage; \ No newline at end of file +export default DocPage; diff --git a/website/src/theme/DocPage/styles.module.css b/website/src/theme/DocPage/styles.module.css index a5a6755..5ef664f 100644 --- a/website/src/theme/DocPage/styles.module.css +++ b/website/src/theme/DocPage/styles.module.css @@ -44,8 +44,8 @@ background-color: var(--ifm-color-emphasis-200); } - html[data-theme='dark'] .collapsedDocSidebar:hover, - html[data-theme='dark'] .collapsedDocSidebar:focus { + html[data-theme="dark"] .collapsedDocSidebar:hover, + html[data-theme="dark"] .collapsedDocSidebar:focus { background-color: var(--collapse-button-bg-color-dark); } diff --git a/website/src/theme/DocSidebar/styles.module.css b/website/src/theme/DocSidebar/styles.module.css index eb4673e..e2fbd32 100644 --- a/website/src/theme/DocSidebar/styles.module.css +++ b/website/src/theme/DocSidebar/styles.module.css @@ -22,13 +22,13 @@ } .sidebarVersionSwitch { - display: flex; - align-items:center; - padding: 4px 1rem; - margin: 1rem; - border-radius: 0.5rem; - border: 1px solid #eee; - box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03); + display: flex; + align-items: center; + padding: 4px 1rem; + margin: 1rem; + border-radius: 0.5rem; + border: 1px solid #eee; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03); } .sidebarWithHideableNavbar { @@ -88,14 +88,14 @@ margin-top: 4px; } - html[data-theme='dark'] .collapseSidebarButton { + html[data-theme="dark"] .collapseSidebarButton { background-color: var(--collapse-button-bg-color-dark); border: none; border-left: 1px solid var(--ifm-toc-border-color); } - html[data-theme='dark'] .collapseSidebarButton:hover, - html[data-theme='dark'] .collapseSidebarButton:focus { + html[data-theme="dark"] .collapseSidebarButton:hover, + html[data-theme="dark"] .collapseSidebarButton:focus { background-color: var(--ifm-color-emphasis-200); } } @@ -128,4 +128,4 @@ :global(.menu__list-item--collapsed) :global(.menu__list) { height: 0px !important; -} \ No newline at end of file +}