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?
Asked
Active
Viewed 372 times
1
-
you could use a subdomain eg: blog.mydomain.com and the configuration is the like other subdomain – Yasiel Cabrera Feb 15 '20 at 17:11
-
No, I don't want a subdomain – Mostafa Feb 16 '20 at 05:41
1 Answers
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