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


The following commit(s) were added to refs/heads/build-community by this push:
     new 3db5e346 feat: blogs and docs add edti page url btn
3db5e346 is described below

commit 3db5e346ade6fe2d5f119e88f204e1612f83a3b1
Author: shuai <[email protected]>
AuthorDate: Wed Nov 22 17:59:53 2023 +0800

    feat: blogs and docs add edti page url btn
---
 docusaurus.config.js                              | 18 +++++++++++++++++-
 src/components/blog/BlogPostItem/Footer/index.tsx |  5 +++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/docusaurus.config.js b/docusaurus.config.js
index e6d23cfd..4cd55abd 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -55,8 +55,18 @@ const config = {
           customCss: require.resolve('./src/css/custom.scss'),
         },
         docs: {
+          path: 'docs',
+          routeBasePath: 'docs',
           sidebarPath: require.resolve('./sidebars.js'),
           breadcrumbs: true,
+          editUrl: ({locale, versionDocsDirPath, docPath}) => {
+            if (locale !== 'en') {
+              return `https://crowdin.com/project/answer-website/zh-CN`;
+            }
+            return 
`https://github.com/apache/incubator-answer-website/edit/main/${versionDocsDirPath}/${docPath}`;
+          },
+          showLastUpdateAuthor: true,
+          showLastUpdateTime: true,
         },
         blog: false,
       }),
@@ -153,6 +163,12 @@ const config = {
         postsPerPage: 16,
         showReadingTime: true,
         remarkPlugins: [math],
+        editUrl: ({locale, blogDirPath, blogPath}) => {
+          if (locale !== 'en') {
+            return `https://crowdin.com/project/answer-website/zh-CN`;
+          }
+          return 
`https://github.com/apache/incubator-answer-website/edit/main/${blogDirPath}/${blogPath}`;
+        },
       },
     ],
     'docusaurus-plugin-sass',
@@ -167,7 +183,7 @@ const config = {
           if (locale !== 'en') {
             return `https://crowdin.com/project/answer-website/zh-CN`;
           }
-          return 
`https://github.com/apache/incubator-answer-website/edit/build-community/${versionDocsDirPath}/${docPath}`;
+          return 
`https://github.com/apache/incubator-answer-website/edit/main/${versionDocsDirPath}/${docPath}`;
         },
         showLastUpdateAuthor: true,
         showLastUpdateTime: true,
diff --git a/src/components/blog/BlogPostItem/Footer/index.tsx 
b/src/components/blog/BlogPostItem/Footer/index.tsx
index ed73e85a..6c13ef15 100644
--- a/src/components/blog/BlogPostItem/Footer/index.tsx
+++ b/src/components/blog/BlogPostItem/Footer/index.tsx
@@ -10,6 +10,7 @@
   TwitterShareButton,
 } from "react-share";
 
+import EditThisPage from '@theme/EditThisPage';
 import Icon from '@site/src/components/Icon';
 
 import styles from './index.module.css';
@@ -75,6 +76,10 @@ import styles from './index.module.css';
             <Icon name="linkedin" size="16px" />
           </LinkedinShareButton>
         </div>
+
+        <div className='mt-4'>
+          <EditThisPage editUrl={metadata.editUrl} />
+        </div>
       </div>
     )
  }

Reply via email to