Skip to content

Commit

Permalink
Merge branch 'master' into topics/gatsby-link-location
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews authored Jan 8, 2018
2 parents eb5f866 + f19fc2a commit 7cda16a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
9 changes: 8 additions & 1 deletion docs/docs/building-with-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ export const pageQuery = graphql`
`src/layouts/index.jsx` (optional) wraps page components. You can use it for
portions of pages that are shared across pages like headers and footers.

You can use the `location` prop to render conditionally based on the page
URL.

Example:

```jsx
Expand All @@ -132,7 +135,11 @@ import Navigation from "../components/Navigation/Navigation.jsx";

export default class Template extends React.Component {
render() {
return <Navigation>{this.props.children()}</Navigation>;
if (this.props.location.pathname !== "/") {
return <Navigation>{this.props.children()}</Navigation>;
} else {
return this.props.children();
}
}
}
```
Expand Down
11 changes: 11 additions & 0 deletions docs/docs/gatsby-starters.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,14 @@ Community:
* Password Change
* Protected Routes with Authorization
* Realtime Database with Users

* [gatsby-starter-ceevee](https://github.com/amandeepmittal/gatsby-starter-ceevee) [(demo)](http://gatsby-starter-ceevee.surge.sh/)

Features:

* Based on the Ceevee site template, design by [Styleshout](https://www.styeshout.com/)
* Single Page Resume/Portfolio site
* Target audience Developers, Designers, etc.
* Used CSS Modules, easy to manipulate
* FontAwsome Library for icons
* Responsive Design, optimized for Mobile devices
2 changes: 2 additions & 0 deletions docs/docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ root.

## Official plugins

* [gatsby-plugin-canonical-urls](/packages/gatsby-plugin-canonical-urls/)
* [gatsby-plugin-catch-links](/packages/gatsby-plugin-catch-links/)
* [gatsby-plugin-create-client-paths](/packages/gatsby-plugin-create-client-paths/)
* [gatsby-plugin-coffeescript](/packages/gatsby-plugin-coffeescript/)
Expand Down Expand Up @@ -148,6 +149,7 @@ root.
* [gatsby-plugin-segment-js](https://github.com/benjaminhoffman/gatsby-plugin-segment-js)
* [gatsby-plugin-stripe-checkout](https://github.com/njosefbeck/gatsby-plugin-stripe-checkout)
* [gatsby-plugin-stripe-elements](https://github.com/njosefbeck/gatsby-plugin-stripe-elements)
* [gatsby-plugin-svg-sprite](https://github.com/marcobiedermann/gatsby-plugin-svg-sprite)
* [gatsby-plugin-svgr](https://github.com/zabute/gatsby-plugin-svgr)
* [gatsby-plugin-typescript-css-modules](https://github.com/jcreamer898/gatsby-plugin-typescript-css-modules)
* [gatsby-plugin-yandex-metrika](https://github.com/viatsko/gatsby-plugin-yandex-metrika)
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial/part-one/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default () =>
<div style={{ color: `tomato` }}>
<h1>Hello Gatsby!</h1>
<p>What a world.</p>
<img src="http://lorempixel.com/400/200/" alt="" />
<img src="https://source.unsplash.com/random/400x200" alt="" />
</div>
```

Expand Down Expand Up @@ -166,7 +166,7 @@ export default () =>
<div style={{ color: `tomato` }}>
<h1>Hello Gatsby!</h1>
<p>What a world.</p>
<img src="http://lorempixel.com/400/200/" alt="" />
<img src="https://source.unsplash.com/random/400x200" alt="" />
<br />
<div>
<Link to="/page-2/">Link</Link>
Expand Down Expand Up @@ -222,7 +222,7 @@ export default () =>
<div style={{ color: `tomato` }}>
<h1>Hello Gatsby!</h1>
<p>What a world.</p>
<img src="http://lorempixel.com/400/200/" alt="" />
<img src="https://source.unsplash.com/random/400x200" alt="" />
<br />
<div>
<Link to="/page-2/">Link</Link>
Expand Down
4 changes: 4 additions & 0 deletions packages/gatsby-plugin-canonical-urls/src/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
exports.onRouteUpdate = ({ location }) => {
const domElem = document.querySelector(`link[rel='canonical']`)
domElem.setAttribute(`href`, `${window.location.origin}${location.pathname}`)
}
1 change: 1 addition & 0 deletions packages/gatsby/src/commands/build-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = async (program: any) => {
// Remove the temp JS bundle file built for the static-site-generator-plugin
try {
fs.unlinkSync(outputFile)
fs.unlinkSync(`${outputFile}.map`)
} catch (e) {
// This function will fail on Windows with no further consequences.
}
Expand Down

0 comments on commit 7cda16a

Please sign in to comment.