<commit_before>---
title: Migrating from v0 to v1
---

## Move source directories (pages, components, utils, etc.) under `src`

[We moved site source files under a "src"
directory](https://github.com/gatsbyjs/gatsby/issues/814) to cleanly separate
them from config/data/build folders so to make integration with various
JavaScript tooling (e.g. [Prettier](https://github.com/prettier/prettier))
simpler.

Everything related to webpack, loaders, Babel, React should work nearly
identically under v1 of Gatsby compared to v0 so this part of the migration is
super easy.

```bash
mkdir src
git mv pages src
git mv components src
git mv utils src
...
```

## Replace react-router's Link component with gatsby-link

Add new package to project.

`npm install --save gatsby-link`

Use in place of react-router's Link

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

// Works identically to react-router's <Link>
<Link to="/another-page/">Another page</Link>
```

Prefixing links is also now handled automatically by our new `<Link>` component
so remove usages of `prefixLink` in links.

Use `gatsby-link` everywhere and things will Just Work™.


## config.toml is now gatsby-config.js

If you previously added site metadata to `config.toml`, move that into
the new `gatsby-config.js`.

You need to remove all requires/imports of `config` in your code.<commit_msg>Clarify migration process to gatsby-link 📝  (#1840)<commit_after>---
title: Migrating from v0 to v1
---

## Move source directories (pages, components, utils, etc.) under `src`

[We moved site source files under a "src"
directory](https://github.com/gatsbyjs/gatsby/issues/814) to cleanly separate
them from config/data/build folders so to make integration with various
JavaScript tooling (e.g. [Prettier](https://github.com/prettier/prettier))
simpler.

Everything related to webpack, loaders, Babel, React should work nearly
identically under v1 of Gatsby compared to v0 so this part of the migration is
super easy.

```bash
mkdir src
git mv pages src
git mv components src
git mv utils src
...
```

## Replace react-router's Link component with gatsby-link

`gatsby-link` is a wrapper for the `<Link>` component in react-router.  It automatically prefixes urls and handles prefetching.  Add `gatsby-link` to your project by running:

`npm install --save gatsby-link`

`gatsby-link` auto-detects whether to use a plain `<Link>` or `<NavLink>` based on what props you pass it.  There's no need to wrap `<IndexLink>` because it was dropped in react-router v4 in favor of the `exact` prop.

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

// Equivalent to react-router's <Link>
<Link to="/page-2/">Page 2</Link>

// Equivalent to react-router's <NavLink>
<Link to="/page-2/" activeClassName="selected">Page 2</Link>

// `exact` prop replaces <IndexLink> from react-router v3
<Link to="/" exact>Home</Link>
```

Prefixing links is also now handled automatically by our new `<Link>` component so remove usages of `prefixLink` in links.

Use `gatsby-link` everywhere and things will Just Work™.

## config.toml is now gatsby-config.js

If you previously added site metadata to `config.toml`, move that into
the new `gatsby-config.js`.

You need to remove all requires/imports of `config` in your code.
{'fraction_non_alphanumeric': 0.10510046367851623, 'fraction_numerical': 0.0074188562596599695, 'mean_word_length': 4.3311367380560135, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6184287', 'n_tokens_mistral': 1053, 'n_tokens_neox': 992, 'n_words': 421}