If this flag is not passed, Gatsby will ignore your pathPrefix. Serve your application with the -prefix-paths flag, like so: If this flag is not passed, Gatsby will ignore your pathPrefix and build the site as if hosted from the root domain. The final step is to build your application with either the -prefix-paths flag or PREFIX_PATHS environment variable, like so: In addition, links to various resources (JavaScript, CSS, images, and other static content) need the same prefix, so that the site continues to function correctly when served with the path prefix in place.Īdding the path prefix is a two step process, as follows: Add to gatsby-config.jsįirstly, add a pathPrefix value to your gatsby-config.js. my-sweet-blog-post/ should be rewritten as /blog/my-sweet-blog-post. Many applications are hosted at something other than the root ( /) of their domain.įor example, a Gatsby blog could live at /blog/, or a site could be hosted on GitHub Pages at /my-gatsby-site/.Įach of these sites needs a prefix added to all paths on the site.
0 Comments
Leave a Reply. |