Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change "docs/home" to "docs" #1257

Merged
merged 9 commits into from
May 7, 2020
Merged
3 changes: 2 additions & 1 deletion content/docs/sidebar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"slug": "home",
"slug": "",
"label": "Home",
"source": "index.md"
},
{
Expand Down
6 changes: 3 additions & 3 deletions redirects-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

"^/((?:deb|rpm)/.+) https://s3-us-east-2.amazonaws.com/dvc-s3-repo/$1 303",
"^/(?:help|chat)/?$ https://discordapp.com/invite/dvwXA2N 303",
"^/(?:docs|documentation)(/.*)?$ /doc$1",
"^/doc/?$ /doc/home 307",
"^/(?:documentation)/?$ /doc",
"^/(?:documentation)/(.*)?/?$ /doc/$1",
"^/doc/home/?$ /doc 307",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"^/doc/home/?$ /doc 307",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see this one in the code?

"^/doc/get-started(/.*)?$ /doc/tutorials/get-started$1",
"^/doc/tutorial/?$ /doc/tutorials",
"^/doc/tutorial/(.*)? /doc/tutorials/deep/$1",
"^/doc/commands-reference(/.*)?$ /doc/command-reference$1",
"^/doc/use-cases/data-and-model-files-versioning/?$ /doc/use-cases/versioning-data-and-model-files",

"^/(.+)/$ /$1"
]
6 changes: 1 addition & 5 deletions src/gatsby/models/docs/onCreateMarkdownContentNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ function createMarkdownDocsNode(api, { parentNode }) {
const { name, relativePath } = parentNode
splitDir[0] = 'doc'

// Make a special exemption for the root doc.
const slug =
parentNode.relativePath === 'docs/index.md'
? '/doc/home'
: path.posix.join('/', ...splitDir, name === 'index' ? '/' : name)
const slug = path.posix.join('/', ...splitDir, name === 'index' ? '' : name)

const fieldData = {
slug,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/shared/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const FILE_EXTENSION = '.md'
function validateRawItem({ slug, source, children }) {
const isSourceDisabled = source === false

if (!slug) {
if (typeof slug !== 'string') {
throw Error("'slug' field is required in objects in sidebar.json")
}

Expand Down