Skip to content

Commit 5643e3e

Browse files
committed
refactor: fix redirect paths
1 parent b486d3e commit 5643e3e

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

docusaurus-common.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { themes } from 'prism-react-renderer';
66
import rehypeKatex from 'rehype-katex';
77
import remarkMath from 'remark-math';
88

9+
import { howToBasePath } from './src/theme/BlogPostItem/utils';
10+
911
export const defaultLocale = 'en';
1012

1113
// A workaround for locale-specific values in the config
@@ -16,7 +18,6 @@ export const __dirname = path.dirname(fileURLToPath(import.meta.url));
1618

1719
export const mainSiteUrl = 'https://docs.logto.io/';
1820
export const tutorialsSiteUrl = 'https://tutorials.logto.io/';
19-
export const howToBasePath = 'how-to';
2021
export const cfPagesBranch = String(process.env.CF_PAGES_BRANCH);
2122
export const isCfPagesPreview = Boolean(cfPagesBranch && cfPagesBranch !== 'master');
2223
export const siteUrls = Object.freeze({

docusaurus-tutorials.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import {
1414
currentLocale,
1515
defaultLocale,
1616
getCloudflareSubdomain,
17-
howToBasePath,
1817
injectHeadTagsPlugin,
1918
isCfPagesPreview,
2019
localeConfigs,
2120
mainSiteUrl,
2221
} from './docusaurus-common.config';
22+
import { howToBasePath } from './src/theme/BlogPostItem/utils';
2323

2424
const getLogtoDocsUrl = () =>
2525
isCfPagesPreview

src/theme/BlogPostItem/Header/TitleWithSelectionDropdown/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import useCategorizedTutorialMetadata from '@site/src/hooks/use-categorized-tuto
1616
import { useCurrentLocalePrefix } from '@site/src/hooks/useCurrentLocalePrefix';
1717
import { onKeyDownHandler } from '@site/src/utils/a11y';
1818

19+
import { howToBasePath } from '../../utils';
1920
import Dropdown from '../SelectionDropdown';
2021

2122
import styles from './index.module.scss';
@@ -143,7 +144,7 @@ const TitleWithSelectionDropdown = (props: Props) => {
143144
slugLastPart
144145
: slugFirstPart + selectedSlugPart + slug.slice(slug.indexOf(slugMiddlePart));
145146

146-
push(`${locale}/tutorials/${targetSlug}`);
147+
push(`${locale}/${howToBasePath}/${targetSlug}`);
147148
}
148149
};
149150

src/theme/BlogPostItem/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const isHowToTutorial = (slug?: string): boolean => /^build-.+-with-.+$/.test(slug || '');
2+
export const howToBasePath = 'how-to';

0 commit comments

Comments
 (0)