Rob
Rob

Reputation: 23

Gatsby: Changing Default Path Names

I'm just starting to use Gatsby and playing with the following template: yellowcake

I would like to change the default path names (specifically posts), but after trying to change the "posts" in the config.yml, but any page I try to access with the new path crashes. I would basically like to change the following:

domain.com/posts/some-article-in-the-content-posts-folder

to

domain.com/my-custom-path/some-article-in-the-content-posts-folder

Upvotes: 1

Views: 356

Answers (1)

Shubham Khatri
Shubham Khatri

Reputation: 281626

Apart from replacing the path in config.yml you also need to change the setting in src/cms/cms.js to below

CMS.registerPreviewTemplate('my-custom-path', ({ entry }) => (
  <SinglePostTemplate {...entry.toJS().data} />
))

P.S. Clean your gatsby cache and rebuild the app once you made the change.

Upvotes: 1

Related Questions