Skip to content

Commit

Permalink
Merge branch 'master' into sync-db-autosaves
Browse files Browse the repository at this point in the history
  • Loading branch information
Moocar committed Nov 29, 2018
2 parents b4e738e + 71d7f23 commit 83421d4
Show file tree
Hide file tree
Showing 218 changed files with 2,360 additions and 681 deletions.
1 change: 1 addition & 0 deletions docs/blog/2018-09-27-reach-router/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Related Gatsby docs:
- [V2 Migration Guide](/docs/migrating-from-v1-to-v2/#migrate-from-react-router-to-reachrouter)
- [Gatsby Link API reference](/docs/gatsby-link/)
- [V2 announcement blog post](/blog/2018-09-17-gatsby-v2/)
- [Making your site accessible](/docs/making-your-site-accessible)

External references:

Expand Down
1 change: 1 addition & 0 deletions docs/blog/2018-11-07-gatsby-for-apps/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ tags:
- applications
- beyond static
excerpt: Gatsby is great for not only static sites but also traditional web applications. Using Gatsby enables the benefits of both static and web applications so you don't have to sacrifice the advantages of one approach to reap the benefits of the other.
cover: images/what-if-i-told-you.jpg
---

Gatsby is great for static sites. You probably know this! It’s equally great for web applications. You may not know this. Gatsby is great for building web experiences that leverage the benefits of both so called static sites and web applications -- simultaneously. You don't have to sacrifice the advantages of one approach to reap the benefits of the other.
Expand Down
4 changes: 3 additions & 1 deletion docs/docs/creating-and-modifying-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,16 @@ _Note: There's also a plugin that will remove all trailing slashes from pages au
[gatsby-plugin-remove-trailing-slashes](/packages/gatsby-plugin-remove-trailing-slashes/)_.

```javascript:title=gatsby-node.js
// Replacing '/' would result in empty string which is invalid
const replacePath = path => (path === `/` ? path : path.replace(/\/$/, ``))
// Implement the Gatsby API “onCreatePage”. This is
// called after every page is created.
exports.onCreatePage = ({ page, actions }) => {
const { createPage, deletePage } = actions
return new Promise(resolve => {
const oldPage = Object.assign({}, page)
// Remove trailing slash unless page is /
page.path = _path => (_path === `/` ? _path : _path.replace(/\/$/, ``))
page.path = replacePath(page.path)
if (page.path !== oldPage.path) {
// Replace new page with old page
deletePage(oldPage)
Expand Down
43 changes: 38 additions & 5 deletions docs/docs/gatsby-link.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,41 @@ render () {
}
```

You can also pass state to pages when you navigate e.g. `navigate("/a-path/", { state: { pleasant: "reasonably" }}`

Note that `navigate` was previously named `navigateTo`. `navigateTo` is deprecated in Gatsby v2.

## Passing state through Link and Navigate

You can pass state to pages when you navigate, such as:

```javascript
navigate(`/a-path/`, { state: { pleasant: `reasonably` }}
```
You can also pass state to pages when you use `Link`:
```jsx
<Link
to="/another-page/"
activeStyle={{
color: "red",
}}
state={{
pleasant: "reasonably",
}}
>
```
This is accessible from the `location` object on the new page:
```javascript
componentDidMount() {
const pleasant = this.props.location.state.pleasant
this.setState({
pleasant: pleasant
})
}
```
## Prefixed paths helper
It is common to host sites in a sub-directory of a site. Gatsby lets you [set
Expand Down Expand Up @@ -136,7 +167,9 @@ following may be a good starting point:
```jsx
import { Link as GatsbyLink } from "gatsby"

const Link = ({ children, to, ...other }) => {
// Since DOM elements <a> cannot receive activeClassName,
// destructure the prop here and pass it only to GatsbyLink
const Link = ({ children, to, activeClassName, ...other }) => {
// Tailor the following test to your environment.
// This example assumes that any internal link (intended for Gatsby)
// will start with exactly one slash, and that anything else is external.
Expand All @@ -145,7 +178,7 @@ const Link = ({ children, to, ...other }) => {
// Use Gatsby Link for internal links, and <a> for others
if (internal) {
return (
<GatsbyLink to={to} {...other}>
<GatsbyLink to={to} activeClassName={activeClassName} {...other}>
{children}
</GatsbyLink>
)
Expand All @@ -164,7 +197,7 @@ export default Link
You can similarly check for file downloads:
```
```jsx
const file = /\.[0-9a-z]+$/i.test(to)

...
Expand Down
37 changes: 37 additions & 0 deletions docs/docs/making-your-site-accessible.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "Making your site accessible"
---

## What is accessibility?

Back in the early days of the Web, Tim Berners-Lee, inventor of the World Wide Web, [said](https://www.w3.org/Press/IPO-announce):

> "The power of the Web is in its universality.
> Access by everyone regardless of disability is an essential aspect."
The web of today is an important resource in many aspects of life such as health care, education, or commerce. Accessibility is an important consideration when building for the web.

[Web accessibility](https://www.w3.org/WAI/fundamentals/accessibility-intro/#what) means that websites, tools, and technologies are designed and developed so that people with disabilities can use them. But not only people with permanent disabilities benefit from it. Accessibility also benefits people with temporary disabilities. For example imagine being in a environment where you cannot listen to audio or if you had a broken arm.

Accessibility [supports](https://www.w3.org/standards/webdesign/accessibility#case) social inclusion for everyone, and has a strong business case.

## Gatsby helps build in accessibility

While ultimately it's up to you to develop your site with accessibility in mind, Gatsby aims to provide as much out-of-the-box support as possible.

### Accessible routing

One of the most common features of every site is navigation. People should be able to navigate across your pages and content in an intuitive and accessible way.

That's why every Gatsby site has an accessible navigation experience by default.

It is possible thanks to [@reach/router](https://reach.tech/router), a routing library for React, that provides focus management on page change. It also has a ~70% smaller bundle size than the famous [react-router](https://github.com/ReactTraining/react-router).

Since the [second major release](https://www.gatsbyjs.org/blog/2018-09-17-gatsby-v2/), your Gatsby sites use `@reach/router` under the hood. The [Gatsby Link Component](https://www.gatsbyjs.org/docs/gatsby-link/) wraps [@reach/router's Link component](https://reach.tech/router/api/Link), so you don't need to think about it.

## How to improve accessibility?

Accessibility by default is a win for everyone. Learn more about web accessibility in general:

- [Free course](https://www.udacity.com/course/web-accessibility--ud891) by Google and Udacity.
- [WebAIM introduction](https://webaim.org/intro/) to web accessibility.
48 changes: 48 additions & 0 deletions docs/sites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3563,3 +3563,51 @@
built_by: Samuel Fialho
built_by_url: https://samuelfialho.com
featured: false
- title: JoinUp HR chatbot
url: https://www.joinup.io
main_url: https://www.joinup.io
description: Custom HR chatbot for better candidate experience
categories:
- App
- Chatbot
- HR
- Technology
featured: false
- title: JDCastro Web Design & Development
main_url: https://jacobdcastro.com
url: https://jacobdcastro.com
source_url: https://github.com/jacobdcastro/personal-site
featured: false
description: >
A small business site for freelance web designer and developer Jacob D. Castro. Includes professional blog, contact forms, and soon-to-come portfolio of sites for clients. Need a new website or an extra developer to share the workload? Feel free to check out the website!
categories:
- Blog
- Portfolio
- Business
- Freelance
built_by: Jacob D. Castro
built_by_url: https://twitter.com/jacobdcastro
- title: Gatsby Tutorials
main_url: https://www.gatsbytutorials.com
url: https://www.gatsbytutorials.com
source_url: https://github.com/ooloth/gatsby-tutorials
featured: false
description: >
Gatsby Tutorials is a community-updated list of video, audio and written tutorials to help you learn GatsbyJS.
categories:
- Web Development
- Education
- Open Source
built_by: Michael Uloth
built_by_url: "https://www.michaeluloth.com"
- title: Up & Running Tutorials
main_url: https://www.upandrunningtutorials.com
url: https://www.upandrunningtutorials.com
featured: false
description: >
Free coding tutorials for web developers. Get your web development career up and running by learning to build better, faster websites.
categories:
- Web Development
- Education
built_by: Michael Uloth
built_by_url: "https://www.michaeluloth.com"
5 changes: 5 additions & 0 deletions docs/starters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@
- PWA
- Netlify CMS
- Disqus
- Search
- Pagination
features:
- Complete Business Website Suite - Home Page, About Page, Pricing Page, Contact Page and Blog
- Netlify CMS for Content Management
Expand All @@ -216,6 +218,9 @@
- Progressive Web App & Offline Support
- Tags and RSS Feed for Blog
- Disqus and Share Support
- Elastic-Lunr Search
- Pagination
- Easy Configuration using `config.js` file
- url: https://haysclark.github.io/gatsby-starter-casper/
repo: https://github.com/haysclark/gatsby-starter-casper
description: n/a
Expand Down
6 changes: 6 additions & 0 deletions packages/babel-plugin-remove-graphql-queries/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="2.5.2"></a>

## [2.5.2](https://github.com/gatsbyjs/gatsby/compare/babel-plugin-remove-graphql-queries@[email protected]) (2018-11-29)

**Note:** Version bump only for package babel-plugin-remove-graphql-queries

<a name="2.5.1"></a>

## [2.5.1](https://github.com/gatsbyjs/gatsby/compare/babel-plugin-remove-graphql-queries@[email protected]) (2018-10-29)
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-remove-graphql-queries/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "babel-plugin-remove-graphql-queries",
"version": "2.5.1",
"version": "2.5.2",
"author": "Jason Quense <[email protected]>",
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"babel-preset-gatsby-package": "^0.1.2"
"babel-preset-gatsby-package": "^0.1.3"
},
"license": "MIT",
"main": "index.js",
Expand Down
8 changes: 8 additions & 0 deletions packages/babel-preset-gatsby-package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="0.1.3"></a>

## [0.1.3](https://github.com/gatsbyjs/gatsby/compare/[email protected]@0.1.3) (2018-11-29)

### Bug Fixes

- **gatsby-plugin-netlify-cms:** dynamically import netlify-identity-widget ([#9565](https://github.com/gatsbyjs/gatsby/issues/9565)) ([49100e9](https://github.com/gatsbyjs/gatsby/commit/49100e9))

<a name="0.1.2"></a>

## [0.1.2](https://github.com/gatsbyjs/gatsby/compare/[email protected]@0.1.2) (2018-10-29)
Expand Down
12 changes: 12 additions & 0 deletions packages/babel-preset-gatsby-package/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ it(`Specifies proper presets and plugins in Node mode`, () => {
path.join(`@babel`, `plugin-proposal-optional-chaining`)
),
expect.stringContaining(path.join(`@babel`, `plugin-transform-runtime`)),
expect.stringContaining(
path.join(`@babel`, `plugin-syntax-dynamic-import`)
),
])
})

Expand Down Expand Up @@ -66,6 +69,9 @@ it(`Specifies proper presets and plugins in debug Node mode`, () => {
path.join(`@babel`, `plugin-proposal-optional-chaining`)
),
expect.stringContaining(path.join(`@babel`, `plugin-transform-runtime`)),
expect.stringContaining(
path.join(`@babel`, `plugin-syntax-dynamic-import`)
),
])
})

Expand Down Expand Up @@ -100,6 +106,9 @@ it(`Specifies proper presets and plugins in browser mode`, () => {
path.join(`@babel`, `plugin-proposal-optional-chaining`)
),
expect.stringContaining(path.join(`@babel`, `plugin-transform-runtime`)),
expect.stringContaining(
path.join(`@babel`, `plugin-syntax-dynamic-import`)
),
])
})

Expand Down Expand Up @@ -134,5 +143,8 @@ it(`Specifies proper presets and plugins in debug browser mode`, () => {
path.join(`@babel`, `plugin-proposal-optional-chaining`)
),
expect.stringContaining(path.join(`@babel`, `plugin-transform-runtime`)),
expect.stringContaining(
path.join(`@babel`, `plugin-syntax-dynamic-import`)
),
])
})
1 change: 1 addition & 0 deletions packages/babel-preset-gatsby-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function preset(context, options = {}) {
r(`@babel/plugin-proposal-class-properties`),
r(`@babel/plugin-proposal-optional-chaining`),
r(`@babel/plugin-transform-runtime`),
r(`@babel/plugin-syntax-dynamic-import`),
],
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-preset-gatsby-package/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "babel-preset-gatsby-package",
"version": "0.1.2",
"version": "0.1.3",
"author": "Philipp Spiess <[email protected]>",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/babel-preset-gatsby/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="0.1.5"></a>

## [0.1.5](https://github.com/gatsbyjs/gatsby/compare/[email protected]@0.1.5) (2018-11-29)

**Note:** Version bump only for package babel-preset-gatsby

<a name="0.1.4"></a>

## [0.1.4](https://github.com/gatsbyjs/gatsby/compare/[email protected]@0.1.4) (2018-11-15)
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-preset-gatsby/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-gatsby",
"version": "0.1.4",
"version": "0.1.5",
"author": "Philipp Spiess <[email protected]>",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.0.0",
Expand All @@ -18,6 +18,6 @@
"watch": "babel -w src --out-dir . --ignore **/__tests__"
},
"devDependencies": {
"babel-preset-gatsby-package": "^0.1.2"
"babel-preset-gatsby-package": "^0.1.3"
}
}
6 changes: 6 additions & 0 deletions packages/gatsby-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="2.4.6"></a>

## [2.4.6](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-cli/compare/[email protected]@2.4.6) (2018-11-29)

**Note:** Version bump only for package gatsby-cli

<a name="2.4.5"></a>

## [2.4.5](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-cli/compare/[email protected]@2.4.5) (2018-11-08)
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-cli",
"description": "Gatsby command-line interface for creating new sites and running Gatsby commands",
"version": "2.4.5",
"version": "2.4.6",
"author": "Kyle Mathews <[email protected]>",
"bin": {
"gatsby": "lib/index.js"
Expand Down Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"babel-preset-gatsby-package": "^0.1.2",
"babel-preset-gatsby-package": "^0.1.3",
"cross-env": "^5.1.4"
},
"files": [
Expand Down
6 changes: 6 additions & 0 deletions packages/gatsby-codemods/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

<a name="1.0.8"></a>

## [1.0.8](https://github.com/gatsbyjs/gatsby/compare/[email protected]@1.0.8) (2018-11-29)

**Note:** Version bump only for package gatsby-codemods

<a name="1.0.7"></a>

## [1.0.7](https://github.com/gatsbyjs/gatsby/compare/[email protected]@1.0.7) (2018-11-08)
Expand Down
Loading

0 comments on commit 83421d4

Please sign in to comment.