1

I want to combine 2 Gatsby sites in one domain, for example, Gatsby1 (landing page) in mydomain.com, and Gatsby2 (blog) in mydomain.com/blog, how can I do that?

Mostafa
  • 1,501
  • 3
  • 21
  • 37

1 Answers1

1

Create two Gatbsy projects. One can be configured from the root mydomain.com. One needs to use path prefixes:

gatsby-config.js

module.exports = {
  pathPrefix: `/blog`,
}

When you build you need to use a flag: gatsby build --prefix-paths.

EliteRaceElephant
  • 7,744
  • 4
  • 47
  • 62
  • thanks, but it confuses me even more, because it seems similar to basepath, I asked another question: https://stackoverflow.com/questions/60245845/gatsby-whats-the-difference-between-basepath-and-path-prefix – Mostafa Feb 16 '20 at 13:24
  • and using path prefix seems problematic with Netlify, I am trying to avoid this method: https://stackoverflow.com/questions/56425441/deploy-gatsby-site-to-netlify-with-prefix-paths?rq=1 – Mostafa Feb 16 '20 at 13:27