【发布时间】:2020-02-04 13:40:09
【问题描述】:
我目前正在使用 Gatsby Starter 博客 (https://github.com/gatsbyjs/gatsby-starter-blog) - 我可以毫无问题地在本地运行它。
但是我想更改 URL 结构 -
目前,如果我发表一篇名为“hello world”的博文,那么 URL 将是“www.example/hello-world”。我希望 URL 采用“www.example/blog/hello-world”的形式。
我看过一些关于在 gatsby-node.js 中更改设置的帖子,但没有具体解决我的问题。我不清楚我需要更改什么,因为 Gatsby 链接 API 和网络开发对我来说都是相当新的。
【问题讨论】:
-
多亏看了那段视频,我确实开始工作了 - 谢谢!
-
供跟踪的人将来参考 - 将
path: post.node.fields.slug更改为path: ``/blog${post.node.fields.slug}。
标签: javascript html url hyperlink gatsby