fix(website): fix i18n routes for Canny board (#5902)

This commit is contained in:
Joshua Chen 2021-11-08 13:17:52 +08:00 committed by GitHub
parent 0fc7adfba9
commit c8904f1615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -14,16 +14,16 @@ import styles from './styles.module.css';
const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91';
function FeatureRequests(): JSX.Element {
function FeatureRequests({basePath}: {basePath: string}): JSX.Element {
useEffect(() => {
cannyScript();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const {Canny} = window as any;
Canny('render', {
boardToken: BOARD_TOKEN,
basePath: '/feature-requests',
basePath,
});
}, []);
}, [basePath]);
return (
<Layout title="Feedback" description="Docusaurus 2 Feature Requests page">

View file

@ -15,10 +15,15 @@ function FeatureRequestsPlugin(context) {
return {
name: 'feature-requests-plugin',
async contentLoaded({actions}) {
const basePath = normalizeUrl([context.baseUrl, '/feature-requests']);
await actions.createData('paths.json', JSON.stringify(basePath));
actions.addRoute({
path: normalizeUrl([context.baseUrl, '/feature-requests']),
path: basePath,
exact: false,
component: '@site/src/featureRequests/FeatureRequestsPage',
modules: {
basePath: './feature-requests-plugin/default/paths.json',
},
});
},
};