Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Page collections #414

Closed
renatorib opened this issue Sep 2, 2016 · 4 comments
Closed

Feature Request: Page collections #414

renatorib opened this issue Sep 2, 2016 · 4 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more.

Comments

@renatorib
Copy link

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.

@KyleAMathews
Copy link
Contributor

With the current Gatsby I'd suggest you maintain the data as you suggest and then auto-generate JSON files for each page and create a json wrapper component (like https://github.com/gatsbyjs/gatsby-starter-default/blob/master/wrappers/json.js) for the landing pages.

For Gatsby 1.0 — read #420 and #421 — would love to hear your reaction to my ideas!

@renatorib
Copy link
Author

Yes, I have the json wrapper :)

Nice to know you are working on 1.0
I'll check this!

@stale
Copy link

stale bot commented Oct 22, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Oct 22, 2017
@stale
Copy link

stale bot commented Nov 7, 2017

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more.
2 participants