Skip to content

Commit e7327b4

Browse files
committed
refactor: fix links
1 parent 32ebef3 commit e7327b4

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

docs/integrations/sms/tencent-sms/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ For detailed guidance, click the “Getting Started Guide” (新手配置指引
6464

6565
You can type in a phone number and click on "Send" to see whether the settings can work before "Save and Done".
6666

67-
That's it. Don't forget to <MainSiteUrl href="/connectors/sms-connectors#enable-phone-number-sign-up-or-sign-in"> Enable connector in sign-in experience</MainSiteUrl>.
67+
That's it. Don't forget to <MainSiteUrl href="/connectors/sms-connectors#enable-phone-number-sign-up-or-sign-in">Enable connector in sign-in experience</MainSiteUrl>.
6868

6969
### Config types \{#config-types}
7070

docusaurus-common.config.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ export const localePath = currentLocale === defaultLocale ? '' : currentLocale;
1515
export const __dirname = path.dirname(fileURLToPath(import.meta.url));
1616

1717
export const mainSiteUrl = 'https://docs.logto.io/';
18+
export const tutorialsSiteUrl = 'https://tutorials.logto.io/';
1819
export const cfPagesBranch = String(process.env.CF_PAGES_BRANCH);
1920
export const isCfPagesPreview = Boolean(cfPagesBranch && cfPagesBranch !== 'master');
21+
export const siteUrls = Object.freeze({
22+
main: mainSiteUrl,
23+
tutorials: tutorialsSiteUrl,
24+
});
25+
26+
type Site = keyof typeof siteUrls;
2027

2128
// https://community.cloudflare.com/t/algorithm-to-generate-a-preview-dns-subdomain-from-a-branch-name/477633/2
2229
export const getCloudflareSubdomain = (branchName: string) =>
@@ -94,9 +101,10 @@ export const injectHeadTagsPlugin: PluginConfig = () => ({
94101
* in the tutorials site would result 404 errors if the URL is not prefixed with the main site
95102
* domain, as each site is a standalone single-page application.
96103
*/
97-
export const createCommonThemeConfig = (isMainSite: boolean) => {
98-
const buildUrl = (pathname: string) =>
99-
isMainSite ? pathname : new URL(pathname, mainSiteUrl).href;
104+
export const createCommonThemeConfig = (site: Site) => {
105+
const buildUrl = (pathname: string, forSite: Site) =>
106+
site === forSite ? pathname : new URL(pathname, siteUrls[forSite]).href;
107+
100108
return Object.freeze({
101109
navbar: {
102110
logo: {
@@ -107,17 +115,17 @@ export const createCommonThemeConfig = (isMainSite: boolean) => {
107115
},
108116
items: [
109117
{
110-
to: buildUrl('/'),
118+
to: buildUrl('/introduction', 'main'),
111119
position: 'left',
112120
label: 'Docs',
113121
},
114122
{
115-
to: buildUrl('/quick-starts'),
123+
to: buildUrl('/quick-starts', 'main'),
116124
position: 'left',
117125
label: 'Quick starts',
118126
},
119127
{
120-
to: buildUrl('/integrations'),
128+
to: buildUrl('/integrations', 'main'),
121129
position: 'left',
122130
label: 'Integrations',
123131
},
@@ -138,9 +146,9 @@ export const createCommonThemeConfig = (isMainSite: boolean) => {
138146
{
139147
title: 'Developers',
140148
items: [
141-
{ label: 'Docs', to: buildUrl('/') },
142-
{ label: 'Quick starts', to: buildUrl('/quick-starts') },
143-
{ label: 'Integrations', to: buildUrl('/integrations') },
149+
{ label: 'Docs', to: buildUrl('/introduction', 'main') },
150+
{ label: 'Quick starts', to: buildUrl('/quick-starts', 'main') },
151+
{ label: 'Integrations', to: buildUrl('/integrations', 'main') },
144152
{
145153
label: 'Account API',
146154
href: 'https://openapi.logto.io/group/endpoint-account-center',
@@ -150,7 +158,7 @@ export const createCommonThemeConfig = (isMainSite: boolean) => {
150158
href: 'https://openapi.logto.io/group/endpoint-experience',
151159
},
152160
{ label: 'Management API', href: 'https://openapi.logto.io' },
153-
{ label: 'Build X with Y', href: 'pathname:///tutorials' },
161+
{ label: 'Build X with Y', to: tutorialsSiteUrl + 'tutorials' }, // TODO: @gao temporarily hardcode the URL, we'll update it later
154162
],
155163
},
156164
{

docusaurus-tutorials.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const config: Config = {
6767
],
6868

6969
stylesheets: commonStylesheets,
70-
themeConfig: createCommonThemeConfig(false),
70+
themeConfig: createCommonThemeConfig('tutorials'),
7171

7272
plugins: [
7373
addAliasPlugin,

docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const config: Config = {
5050
presets: [['classic', classicPresetConfig]],
5151

5252
stylesheets: commonStylesheets,
53-
themeConfig: createCommonThemeConfig(true),
53+
themeConfig: createCommonThemeConfig('main'),
5454

5555
plugins: [
5656
addAliasPlugin,

0 commit comments

Comments
 (0)