Skip to content

Commit

Permalink
Change "docs/home" to "docs" (#1257)
Browse files Browse the repository at this point in the history
* Move /doc/home to /doc

- Change sidebar.json to point Home to the new url and keep the same label.
- Change DocsPage model to generate home at new url.
- Swap /doc -> /doc/home redirect to the other way around.
- Change link component to allow empty strings that aren't undefined.

* Re-add 307 code to swapped redirect

* remove unnecessary falsy checks

* remove old comment

* Don't use '/' in doc home path creation

* Change up redirects so new docs home never has a trailing slash

* Remove old reversed redirect

* Change instance of /doc/home to /doc

* Fix slightly messed up redirects list
  • Loading branch information
rogermparent authored May 7, 2020
1 parent 7dd2c04 commit bce4d6a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions content/blog/2020-04-30-gsod-ideas-2020.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ few skills we look for in applicants.
friendly wording as much as possible and pay close attention to consistency
in our terminology. Our team will help with copy editing.

1. **Command line experience.** [DVC](/doc/home) is a command line tool that
builds on top of [Git](https://git-scm.com/), so being able to play with it
and test the features will be very useful. Creating and managing files,
GNU/Linux commands, file and permission administration are desired skills.
1. **Command line experience.** [DVC](/doc) is a command line tool that builds
on top of [Git](https://git-scm.com/), so being able to play with it and test
the features will be very useful. Creating and managing files, GNU/Linux
commands, file and permission administration are desired skills.

1. **People skills.** We put a high value on communication: the ability to
discuss ideas, explain your goals, report progress, and work kindly with more
Expand Down
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
1 change: 0 additions & 1 deletion redirects-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"^/((?: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",
"^/doc/get-started(/.*)?$ /doc/tutorials/get-started$1",
"^/doc/tutorial/?$ /doc/tutorials",
"^/doc/tutorial/(.*)? /doc/tutorials/deep/$1",
Expand Down
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

0 comments on commit bce4d6a

Please sign in to comment.