7.0.0: Configurable collections and Day.js
Changes
See #17
- The
postscollection no longer has any special hardcoded behaviour. Instead it's just another collection.- Pages now receive a
collectionsprop instead of apostsprop - The collection used to generate the JSON feed is configured in package.json with
tropical.feedCollection
- Pages now receive a
- Collection sorting now uses Day.js under the hood. It's a dependency so it can be used for all your date and time needs.
Upgrade instructions (more info)
Merge upstream changes
First, configure this repo as a remote for your repo (you only need to do this once)
git remote add template https://github.com/bensmithett/tropical.git
Then fetch & merge the latest changes, resolving any conflicts manually:
git fetch template
git merge template/master
or...
Manually update your code
- Install Day.js:
yarn add dayjs - Update
prerender.jsas per https://github.com/bensmithett/tropical/pull/17/files#diff-36c4430d199533126f4c93fec3350cbd- Import
dayjsand configure with theisSameOrBeforeplugin https://github.com/bensmithett/tropical/pull/17/files#diff-36c4430d199533126f4c93fec3350cbdR20-R22 - Add the
gatherCollectionsfunction and delete the existingcollectPostsfunction - Update the
buildJSONFeedfunction to use the collection defined intropical.feedCollectionrather than the hardcodedpostscollection https://github.com/bensmithett/tropical/pull/17/files#diff-36c4430d199533126f4c93fec3350cbdR154-R155
- Import
- Add
tropical.feedCollectionto your package.json https://github.com/bensmithett/tropical/pull/17/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R37 - Change this line in
build.jsto get a better stack trace when something breaks in your prerender function https://github.com/bensmithett/tropical/pull/17/files#diff-642903a5178e20be297fb90c571826a2R187