mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +02:00
docs(v2): GH pages: recommend using trailingSlash (#5033)
This commit is contained in:
parent
f20599bb54
commit
41eaa690ee
2 changed files with 12 additions and 1 deletions
|
@ -47,6 +47,17 @@ export default async function deploy(
|
||||||
customOutDir: cliOptions.outDir,
|
customOutDir: cliOptions.outDir,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (typeof siteConfig.trailingSlash === 'undefined') {
|
||||||
|
console.warn(
|
||||||
|
chalk.yellow(`
|
||||||
|
Docusaurus recommendation:
|
||||||
|
When deploying to GitHub Pages, it is better to use an explicit "trailingSlash" site config.
|
||||||
|
Otherwise, GitHub Pages will add an extra trailing slash to your site urls only on direct-access (not when navigation) with a server redirect.
|
||||||
|
This behavior can have SEO impacts and create relative link issues.
|
||||||
|
`),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Deploy command invoked...');
|
console.log('Deploy command invoked...');
|
||||||
if (!shell.which('git')) {
|
if (!shell.which('git')) {
|
||||||
throw new Error('Git not installed or on the PATH!');
|
throw new Error('Git not installed or on the PATH!');
|
||||||
|
|
|
@ -90,7 +90,7 @@ You may refer to GitHub Pages' documentation [User, Organization, and Project Pa
|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
|
|
||||||
GitHub Pages adds a trailing slash to Docusaurus URLs by default. Adjusting the `trailingSlash` setting can be useful.
|
GitHub Pages adds a trailing slash to Docusaurus URLs by default. It is recommended to set a `trailingSlash` config (`true` or `false`, not `undefined`).
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue