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

[www] Move Plugins page from /packages to /plugins #4705

Merged
merged 8 commits into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion www/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
isPermanent: true,
})

createRedirect({
fromPath: `/packages/`, // Moved "Plugins" page from /packages to /plugins
toPath: `/plugins/`,
isPermanent: true,
})

return new Promise((resolve, reject) => {
const docsTemplate = path.resolve(`src/templates/template-docs-markdown.js`)
const blogPostTemplate = path.resolve(`src/templates/template-blog-post.js`)
Expand Down Expand Up @@ -230,7 +236,7 @@ exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
fileNode.sourceInstanceName === `packages` &&
parsedFilePath.name === `README`
) {
slug = `/packages/${parsedFilePath.dir}/`
slug = `/plugins/${parsedFilePath.dir}/`
createNodeField({
node,
name: `title`,
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/navigation-mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const MobileNavigation = () => (
>
<MobileNavItem linkTo="/docs/" label="Docs" icon={DocsIcon} />
<MobileNavItem linkTo="/tutorial/" label="Tutorial" icon={TutorialIcon} />
<MobileNavItem linkTo="/packages/" label="Plugins" icon={PluginsIcon} />
<MobileNavItem linkTo="/plugins/" label="Plugins" icon={PluginsIcon} />
<MobileNavItem linkTo="/blog/" label="Blog" icon={BlogIcon} />
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default ({ pathname }) => {
>
<NavItem linkTo="/docs/">Docs</NavItem>
<NavItem linkTo="/tutorial/">Tutorial</NavItem>
<NavItem linkTo="/packages/">Plugins</NavItem>
<NavItem linkTo="/plugins/">Plugins</NavItem>
<NavItem linkTo="/features/">Features</NavItem>
<NavItem linkTo="/blog/">Blog</NavItem>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/searchbar-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ const Result = ({ hit, pathname, search }) => {
return (
<Link
to={{
pathname: `/packages/${hit.name}/`,
pathname: `/plugins/${hit.name}/`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this

search: `?=${search}`,
}}
css={{
Expand Down
6 changes: 3 additions & 3 deletions www/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class DefaultLayout extends React.Component {
const isTutorial =
this.props.location.pathname.slice(0, 10) === `/tutorial/`
const isFeature = this.props.location.pathname.slice(0, 9) === `/features`
const isPackage = this.props.location.pathname.slice(0, 9) === `/packages`
const isPackage = this.props.location.pathname.slice(0, 8) === `/plugins`
Copy link
Contributor

Choose a reason for hiding this comment

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

Also check if the pathname is /packages/

const isPackageReadme =
this.props.location.pathname.slice(0, 16) === `/packages/gatsby`
this.props.location.pathname.slice(0, 15) === `/plugins/gatsby`

const hasSidebar =
isDoc || isTutorial || isFeature || isPackage || isPackageReadme
Expand All @@ -42,7 +42,7 @@ class DefaultLayout extends React.Component {
const packageSidebarWidth = rhythm(17)

const leftPadding = rhythmSize => {
if (this.props.location.pathname.slice(0, 9) === `/packages`) {
if (this.props.location.pathname.slice(0, 8) === `/plugins`) {
Copy link
Contributor

Choose a reason for hiding this comment

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

check for /packages/ as well

return packageSidebarWidth
} else if (hasSidebar) {
return rhythm(rhythmSize)
Expand Down
File renamed without changes.