Skip to content

Commit df210db

Browse files
committed
[nextra] Fix docs.config.js githubUrl
1 parent df3ab3e commit df210db

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

apps/nextra/docs.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export const docsConfig = Object.freeze({
2323
i18nConfig,
2424
defaultTitle: 'Aptos Docs',
2525
defaultDescription: 'Docs for Aptos',
26-
githubUrl: 'https://github.com/aptos-labs/nextra',
27-
githubDocsUrl: 'https://github.com/aptos-labs/nextra/apps/aptos-swr-site',
28-
githubNewIssueUrl: 'https://github.com/aptos-labs/nextra/issues/new',
26+
githubUrl: 'https://github.com/aptos-labs/developer-docs',
27+
relativeDocsPath: '/apps/nextra',
28+
githubNewIssueUrl: 'https://github.com/aptos-labs/developer-docs/issues/new',
2929
googleAnalyticsId: 'G-LLF79THJN0',
3030
origin: process.env.NEXT_PUBLIC_ORIGIN
3131
})

apps/nextra/pages/en/docs/setup/docs-config.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export const docsConfig = Object.freeze({
6767
i18nConfig,
6868
defaultTitle: 'Aptos Docs',
6969
defaultDescription: 'Docs for Aptos',
70-
githubUrl: 'https://github.com/aptos-labs/nextra',
71-
githubDocsUrl: 'https://github.com/aptos-labs/nextra/apps/aptos-swr-site',
70+
githubUrl: 'https://github.com/aptos-labs/developer-docs',
71+
relativeDocsPath: '/apps/nextra',
7272
githubNewIssueUrl: 'https://github.com/aptos-labs/nextra/issues/new',
7373
googleAnalyticsId: 'G-LLF79THJN0',
7474
origin: process.env.NEXT_PUBLIC_ORIGIN

apps/nextra/theme.config.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,21 @@ function isFullUrl(url: string): boolean {
2424
return pattern.test(url);
2525
}
2626

27+
const url = new URL(docsConfig.githubUrl);
28+
const pathname = url.pathname.endsWith('/') && url.pathname !== '/' ? url.pathname.slice(0, -1) : url.pathname;
29+
const githubUrl = `${url.protocol}//${url.host}${pathname}${url.search}${url.hash}`;
30+
2731
const config: DocsThemeConfig = {
2832
darkMode: true,
29-
docsRepositoryBase: docsConfig.githubDocsUrl,
33+
docsRepositoryBase: docsConfig.githubUrl,
3034
editLink: {
3135
content: function useText() {
3236
const { locale } = useRouter()
3337
return i18nConfig[locale!].editText
38+
},
39+
component: ({ children, className, filePath }) => {
40+
const href = `${githubUrl}/edit/main${docsConfig.relativeDocsPath}/${filePath}`;
41+
return <a className={className} href={href}>{children}</a>
3442
}
3543
},
3644
feedback: {

0 commit comments

Comments
 (0)