7.0.0: Configurable collections and Day.js
Changes
See #17
- The
posts
collection no longer has any special hardcoded behaviour. Instead it's just another collection.- Pages now receive a
collections
prop instead of aposts
prop - 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.js
as per https://github.com/bensmithett/tropical/pull/17/files#diff-36c4430d199533126f4c93fec3350cbd- Import
dayjs
and configure with theisSameOrBefore
plugin https://github.com/bensmithett/tropical/pull/17/files#diff-36c4430d199533126f4c93fec3350cbdR20-R22 - Add the
gatherCollections
function and delete the existingcollectPosts
function - Update the
buildJSONFeed
function to use the collection defined intropical.feedCollection
rather than the hardcodedposts
collection https://github.com/bensmithett/tropical/pull/17/files#diff-36c4430d199533126f4c93fec3350cbdR154-R155
- Import
- Add
tropical.feedCollection
to your package.json https://github.com/bensmithett/tropical/pull/17/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R37 - Change this line in
build.js
to get a better stack trace when something breaks in your prerender function https://github.com/bensmithett/tropical/pull/17/files#diff-642903a5178e20be297fb90c571826a2R187