Giter VIP home page Giter VIP logo

Comments (3)

iojcde avatar iojcde commented on May 24, 2024 1

It should be possible to implement multiple pages, I might make a PR some time for it. We just have to make an array with all the elements, separated by pages in ./data/index.ts.

from destack.

LiveDuo avatar LiveDuo commented on May 24, 2024 1

@JcdeA I've been thinking about multiple pages and came to two possible implementations. Here are my thoughts on the two possibilities and a possible way to get it done!

Possible Solutions

  1. Have multiple json files in the data folder.

Structure:

  • data/default.json
  • data/contact.json
  • data/blog/first-post.json OR data/blog-first-post.json

👍 Backwards compatible
👍 Possibly easier to implement (not have to rewrite the JSON file each time a different page is changed)
👍 More close to what we have atm

  1. Have a single json file as we do now but instead of having an object to have an array. In that case each element in the array would represent a page.

Structure:

  • data/default.json

👍 Less files to commit in git

Implementation (Solution 1)

  1. We can get the pathname from the router and send it with handleEvents to handle function (so it knows where to save each page).
  2. At that point we can parse the pathname and save the page to that path eg. pathname = blog/first-post will save to a first-blog.json in folder name blog (or to a blog-first-blog.json file)
  3. We will have to change loadTemplate a little to account for multiple files.
  4. Lastly, we will need to support multiple files in getStaticProps so we have the props available when the site is statically built for production!

Note: An open question is what to do with dynamic-routes.

from destack.

iojcde avatar iojcde commented on May 24, 2024

Note: An open question is what to do with dynamic-routes.

At that point we could just create a custom server. It'll make a lot of things easier, without trying to cater around next.js's implementation.
We could also provide some kind of simple cli to handle installing & configuration automatically.

However, this probably isn't the best, since next's image optimization won't properly work. We could backport it, though.

from destack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.