A live version of this site can be found online at https://blockstack.org.
Be sure to have node + npm/yarn installed before getting started.
Fork the repo and pull it down to your machine, and then in the directory run:
npm install npm run dev
yarn install yarn dev
dev task will launch a local instance of the site with all the modern advantages of front end work (hot module reloading, etc).
Adding pages / routes
Next.js is first and foremost a directory/file based framework. If you look in the
pages directory, you should get a pretty good idea of the routes contained within this project. To add a new route, simply create a file or folder with the route you want to add, and start coding! Files can be
The blog gets its data from an external source (Ghost) and is parsed via
/blog/single. Even though the data is external, you can still get some insight into how the routes work via the directory structure.
Exporting new pages
Because we are exporting the react application to run in places only static sites can, we have to pass our routes to the
next.config.js file. We have a
routes.js file that contains our static and dynamic routes. When adding a new page, make sure to add the path to this file.
Next.js has a function called
exportPathMap in the
next.config.js which allows the export to know what to export! You can also fetch data at this point to generate dynamic pages. Take a look at
next.config.js to see an example.