Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

After basePath is set, the note's path will not automatically add the value of basePath? #80

Closed
ZionDoki opened this issue Nov 13, 2020 · 3 comments
Assignees

Comments

@ZionDoki
Copy link

Here is my config of basePath.

module.exports = {
  siteMetadata: {
    ...
  },
  plugins: [
    {
      resolve: 'gatsby-theme-code-notes',
      options: {
        contentPath: 'notes',
        basePath: '/notes/',
        showThemeInfo: false,
        showDescriptionInSidebar: true,
        logo: ''
      },
    },
  ],
}

When I set basePath to /notes/, It's works and totally fine, but when I click the note whose URL is todo. It doesn't link to /notes/todo but todo.

I really don't know is this a bug or just my mistake of using. I'm totally rookie in gatsby.

and the other question is how can I get basePath settings through graphql, I couldn't find a way :(

Looking forward to your reply!plz..

@mrmartineau mrmartineau self-assigned this Nov 13, 2020
@ZionDoki
Copy link
Author

Fine, I solve the problem by a simple and crude methods that is add data manually to GraphQL.

Thank you for your work still :)

// path: ./gatsby-node.js

const config = require('./gatsby-config')

exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => {
  config.plugins.forEach(plugin => {
    const node = {
      name: plugin.resolve,
      options: plugin.options,
      id:createNodeId(`Plugin-${plugin.name}`),
      internal: {
        type: "Plugin",
        contentDigest: createContentDigest(plugin),
      },
    }
    actions.createNode(node)
  })
}

I'm still figuring out how to pass basePath to NoteListItem's slug the way that project have

@mrmartineau
Copy link
Owner

hi @ZionDoki, thanks for raising this. I am working on this now and the next release will include the fix

mrmartineau added a commit that referenced this issue Dec 11, 2020
@johnchristopher
Copy link

I have a question. Why can't the static files being rendered be used in any arbitrary folders by using relative paths for CSS and JavaScript files ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants