Skip to content

Commit

Permalink
Adds more information to documentation pages. (#1428)
Browse files Browse the repository at this point in the history
* Completed path-prefix.md.

* Adds navigateTo example to gatsby-link docpage.

* Fixes
  • Loading branch information
Vagr9K authored and KyleAMathews committed Jul 9, 2017
1 parent 5c50702 commit 0ac5342
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/docs/path-prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ module.exports = {
pathPrefix: `/blog`
}
```

Then pass `--prefix-paths` cmd option to Gatsby.

```sh
gatsby build --prefix-paths
```

NOTE: When running the command without the `--prefix-paths` flag, Gatsby ignores your `pathPrefix`.
15 changes: 15 additions & 0 deletions packages/gatsby-link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Edge), this component will also preload code chunks on these browsers.
## How to use

In javascript:

```jsx
import Link from "gatsby-link"

Expand All @@ -38,3 +39,17 @@ render () {
</div>
}
```

## Programmatic navigation

For cases when you can only use event handlers for navigation, you can use `navigateTo`:

```jsx
import { navigateTo } from "gatsby-link"

render () {
<div onClick={navigateTo('/example')}>
<p>Example</p>
</div>
}
```

0 comments on commit 0ac5342

Please sign in to comment.