Skip to content

Commit 80cfafc

Browse files
committed
refactor: fix redirect paths
1 parent b486d3e commit 80cfafc

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

docusaurus-common.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { PluginConfig, ThemeConfig } from '@docusaurus/types';
55
import { themes } from 'prism-react-renderer';
66
import rehypeKatex from 'rehype-katex';
77
import remarkMath from 'remark-math';
8+
import { howToBasePath } from './src/theme/BlogPostItem/utils';
89

910
export const defaultLocale = 'en';
1011

@@ -16,7 +17,6 @@ export const __dirname = path.dirname(fileURLToPath(import.meta.url));
1617

1718
export const mainSiteUrl = 'https://docs.logto.io/';
1819
export const tutorialsSiteUrl = 'https://tutorials.logto.io/';
19-
export const howToBasePath = 'how-to';
2020
export const cfPagesBranch = String(process.env.CF_PAGES_BRANCH);
2121
export const isCfPagesPreview = Boolean(cfPagesBranch && cfPagesBranch !== 'master');
2222
export const siteUrls = Object.freeze({

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)