mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
ENH Make 5 the default version
This commit is contained in:
parent
e4b9170176
commit
0fac8ef0ab
@ -36,6 +36,7 @@ For **new stable releases**, you will need to do the following
|
||||
- Remove the major from the `PRE_RELEASE` array in the `getVersionMessage` function in `src/utils/nodes.ts`
|
||||
- Update the `getDefaultVersion` function's return value to the new stable major in `src/utils/nodes.ts`
|
||||
- Update redirects in `netlify.toml`
|
||||
- Update `index.tsx` to navigate to the new stable major
|
||||
|
||||
When a **major goes EOL**, add the major to the `EOL` array in the `getVersionMessage` function in `src/utils/nodes.ts`
|
||||
|
||||
|
@ -144,11 +144,15 @@ exports.createPages = async ({ actions, graphql, getNodesByType }) => {
|
||||
|
||||
console.log(`Creating legacy redirects...`);
|
||||
const redirects = new Map();
|
||||
const v5docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/5\//));
|
||||
const v4docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/4\//));
|
||||
const v3docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/3\//));
|
||||
|
||||
[...v4docs, ...v3docs].forEach(n => {
|
||||
[...v5docs, ...v4docs, ...v3docs].forEach(n => {
|
||||
const legacy = n.slug.replace(/^\/en\/[0-9]\//, '/en/');
|
||||
if (legacy === '/en/') {
|
||||
return;
|
||||
}
|
||||
if (!redirects.has(legacy)) {
|
||||
redirects.set(legacy, n.slug);
|
||||
}
|
||||
|
18
netlify.toml
18
netlify.toml
@ -2,20 +2,26 @@
|
||||
from = "https://doc.silverstripe.org/*"
|
||||
to = "https://docs.silverstripe.org/:splat"
|
||||
force = true
|
||||
status = 301
|
||||
status = 302
|
||||
|
||||
[[redirects]]
|
||||
from = "/"
|
||||
to = "/en/4/"
|
||||
to = "/en/5/"
|
||||
status = 302
|
||||
|
||||
[[redirects]]
|
||||
from = "/en"
|
||||
to = "/en/5/"
|
||||
status = 302
|
||||
|
||||
[[redirects]]
|
||||
from = "/framework/en/*"
|
||||
to = "/en/4/:splat"
|
||||
status = 301
|
||||
|
||||
to = "/en/5/:splat"
|
||||
status = 302
|
||||
|
||||
[[redirects]]
|
||||
from = "/contributing"
|
||||
to = "/en/4/contributing/"
|
||||
to = "/en/5/contributing/"
|
||||
|
||||
[[redirects]]
|
||||
from = "/en/4/getting_started/installation/common_problems"
|
||||
|
@ -3,7 +3,7 @@ import { navigate } from '@reach/router'
|
||||
|
||||
const IndexPage = () => {
|
||||
useEffect(() => {
|
||||
navigate('/en/4/');
|
||||
navigate('/en/5/');
|
||||
}, []);
|
||||
|
||||
return <div />;
|
||||
|
@ -143,7 +143,7 @@ const getHomePage = (): SilverstripeDocument | null => {
|
||||
/**
|
||||
* Get the default version
|
||||
*/
|
||||
const getDefaultVersion = (): string => '4';
|
||||
const getDefaultVersion = (): string => '5';
|
||||
|
||||
/**
|
||||
* Get the selected version
|
||||
@ -158,7 +158,7 @@ const getVersionMessage = (): ReactElement | ReactElement[] | string | null => {
|
||||
'3',
|
||||
];
|
||||
const PRE_RELEASE = [
|
||||
'5',
|
||||
'6',
|
||||
];
|
||||
const version = getCurrentVersion();
|
||||
const stablePath = getVersionPath(getCurrentNode(), getDefaultVersion());
|
||||
|
Loading…
x
Reference in New Issue
Block a user