1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

create redirects for root of sections

* ref #32
This commit is contained in:
Matthias Kretschmann 2018-11-29 10:47:42 +01:00
parent d3e75d7f54
commit 524174a7c0
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 32 additions and 2 deletions

View File

@ -18,5 +18,19 @@ module.exports = {
githubContentPath:
'https://github.com/oceanprotocol/docs/blob/master/content',
githubDevOceanPath:
'https://github.com/oceanprotocol/dev-ocean/blob/master/doc'
'https://github.com/oceanprotocol/dev-ocean/blob/master/doc',
redirects: [
{
from: '/concepts/',
to: '/concepts/introduction/'
},
{
from: '/setup/',
to: '/setup/quickstart/'
},
{
from: '/tutorials/',
to: '/tutorials/introduction/'
}
]
}

View File

@ -1,5 +1,8 @@
/* eslint-disable no-console */
const path = require('path')
const { createFilePath } = require('gatsby-source-filesystem')
const { redirects } = require('./config')
exports.onCreateNode = ({ node, getNode, actions }) => {
const { createNodeField } = actions
@ -34,7 +37,20 @@ exports.onCreateNode = ({ node, getNode, actions }) => {
}
exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions
const { createPage, createRedirect } = actions
//
// create redirects
//
redirects.forEach(({ from, to }) => {
createRedirect({
fromPath: from,
redirectInBrowser: true,
toPath: to
})
console.log('Create redirect: ' + from + ' --> ' + to)
})
return new Promise((resolve, reject) => {
resolve(