-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Description
Briefing
My project has a big number of Landing pages for sales. One landing page per partner using the same template and changing only the variables.
But, it's a bit complicated. The landing pages change frequently.
Today I have a huge operational task to delete and create new .md files every time it is changed.
To handle that, before I started using Gatsby, we had a script that generate all the things we need in a single json file, a collection file. At that time I had written another script that generate all the pages using the template (gulp and handlebars were my friends).
Suggestion: theory
My suggestion is that it works:
pages/collection.json =>
[
{
"title": "My phone page",
"path": "/my-phone-page",
"cta": "Call me maybe"
},
{
"title": "My selling page",
"path": "/my-selling-page",
"cta": "Buy me, please"
}
]Suggestion: implementation
I confess that I have not mastered the Gatsby code yet, despite having given a good study xD.
But I have a suggest of implementation of this: when Gatsby read the file and parse it, you can check if it's an array, then split in multiple pages. To deal with url resolver, if items not have a path, you can resolve it as /${filename}-${arrayOrder}/: /collection-1/, /collection-2/, etc.