Skip to content

Commit ed27973

Browse files
tsriramKyleAMathews
authored andcommitted
[www] Move Plugins page from /packages to /plugins (#4705)
* move plugins page from /packages to /plugins * revert package slug to /packages * /packages instead of /plugins as path for packages * fix formatting * Update index.js * Update index.js * Fix sidebar
1 parent fe55f6d commit ed27973

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

www/gatsby-node.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
3434
isPermanent: true,
3535
})
3636

37+
createRedirect({
38+
fromPath: `/packages/`, // Moved "Plugins" page from /packages to /plugins
39+
toPath: `/plugins/`,
40+
isPermanent: true,
41+
})
42+
3743
return new Promise((resolve, reject) => {
3844
const docsTemplate = path.resolve(`src/templates/template-docs-markdown.js`)
3945
const blogPostTemplate = path.resolve(`src/templates/template-blog-post.js`)

www/src/components/navigation-mobile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const MobileNavigation = () => (
5252
>
5353
<MobileNavItem linkTo="/docs/" label="Docs" icon={DocsIcon} />
5454
<MobileNavItem linkTo="/tutorial/" label="Tutorial" icon={TutorialIcon} />
55-
<MobileNavItem linkTo="/packages/" label="Plugins" icon={PluginsIcon} />
55+
<MobileNavItem linkTo="/plugins/" label="Plugins" icon={PluginsIcon} />
5656
<MobileNavItem linkTo="/blog/" label="Blog" icon={BlogIcon} />
5757
</div>
5858
)

www/src/components/navigation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export default ({ pathname }) => {
152152
>
153153
<NavItem linkTo="/docs/">Docs</NavItem>
154154
<NavItem linkTo="/tutorial/">Tutorial</NavItem>
155-
<NavItem linkTo="/packages/">Plugins</NavItem>
155+
<NavItem linkTo="/plugins/">Plugins</NavItem>
156156
<NavItem linkTo="/features/">Features</NavItem>
157157
<NavItem linkTo="/blog/">Blog</NavItem>
158158
</ul>

www/src/layouts/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,20 @@ class DefaultLayout extends React.Component {
3131
const isTutorial =
3232
this.props.location.pathname.slice(0, 10) === `/tutorial/`
3333
const isFeature = this.props.location.pathname.slice(0, 9) === `/features`
34-
const isPackage = this.props.location.pathname.slice(0, 9) === `/packages`
34+
const isPackageSearchPage =
35+
this.props.location.pathname.slice(0, 8) === `/plugins` ||
36+
this.props.location.pathname.slice(0, 9) === `/packages`
3537
const isPackageReadme =
3638
this.props.location.pathname.slice(0, 16) === `/packages/gatsby`
3739

3840
const hasSidebar =
39-
isDoc || isTutorial || isFeature || isPackage || isPackageReadme
41+
isDoc || isTutorial || isFeature || isPackageSearchPage || isPackageReadme
4042
const isSearchSource = hasSidebar || isBlog
4143

4244
const packageSidebarWidth = rhythm(17)
4345

4446
const leftPadding = rhythmSize => {
45-
if (this.props.location.pathname.slice(0, 9) === `/packages`) {
47+
if (isPackageReadme || isPackageSearchPage) {
4648
return packageSidebarWidth
4749
} else if (hasSidebar) {
4850
return rhythm(rhythmSize)
@@ -83,11 +85,11 @@ class DefaultLayout extends React.Component {
8385
let searchBarDisplayProperty
8486
let childrenMobileDisplay
8587
let childrenTabletDisplay
86-
if (isPackage && !isPackageReadme) {
88+
if (isPackageSearchPage && !isPackageReadme) {
8789
searchBarDisplayProperty = { display: `block` }
8890
childrenMobileDisplay = { display: `none` }
8991
childrenTabletDisplay = { display: `block` }
90-
} else if (isPackage && isPackageReadme) {
92+
} else if (isPackageSearchPage && isPackageReadme) {
9193
searchBarDisplayProperty = {
9294
[presets.Mobile]: {
9395
display: `none`,
@@ -155,9 +157,9 @@ class DefaultLayout extends React.Component {
155157
css={{
156158
...searchbarStyles,
157159
[presets.Tablet]: {
158-
display: isPackage
160+
display: isPackageSearchPage
159161
? `block`
160-
: isPackage && isPackageReadme ? `block` : `none`,
162+
: isPackageSearchPage && isPackageReadme ? `block` : `none`,
161163
width: packageSidebarWidth,
162164
position: `fixed`,
163165
background: colors.ui.whisper,
File renamed without changes.

0 commit comments

Comments
 (0)