johno / johno/gatsby-theme-documentation

Using pathPrefix creates wrong hyperlinks in sidebar

Open
#147 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
134
Forks
17
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

1. Add `pathPrefix` config to `gatsby-config.js`
2. Build using `gatsby build --prefix-paths` ([Gatsby docs](https://www.gatsbyjs.org/docs/path-prefix/))

### Expected behavior

Paths should have the path prefix added once.
e.g. `/endpoints` would become `/my-path/endpoints` after build.

### Actual behavior

For assets and links inside `.mdx` pages inside `/docs` the path is added once, but for links created in `sidebar.mdx` the path is added twice.
Actual result: `/my-path/my-path/endpoints`

### Actual generated example

`src/gatsby-theme-documentation/sidebar.mdx`
```html


  • Api



  • ```

    ### `gatsby-config.js`

    ```js
    module.exports = {
    siteMetadata: {
    title: 'API Documentation',
    description: 'Docs for API',
    },
    plugins: [
    'gatsby-theme-documentation',
    ],
    pathPrefix: 'my-path',
    }

    ```

    Contributor guide

    No contributing guide indexed for this repository

    Assessment

    This issue has not been assessed yet.

    Get new issues in your inbox

    A short digest of beginner-friendly GitHub issues.