A Metalsmith plugin to create files from a Day One JSON export.
This plugin only works with Day One v2.
Learn how to export your data as JSON from Day One. Don't worry too much about filtering in Day One, since this plugin allows you to filter which journals and entries get built.
After you have the
.zip file, here are the steps to make sure
metalsmith can work with it:
.jsonfile, put that file inside a directory
metalsmith-dayone-example repo for an example with paginated entries and tags pages.
Once you have all your exported Day One data in a directory, just point the
source method at that directory.
This will result in the
destination directory having an
html file for each entry! It will also copy any referenced photos to that directory.
If you already have a
metalsmith site or want to use Day One data in conjunction with other stuff, you probably don't want to change the
source path. In this case, you can provide a
data option to
metalsmith-dayone to tell it where to look for your data.
metalsmith-dayone can unzip the
.zip file for you, but it requires that the
source directory exists. If all you want is Day One data with
metalsmith you'll need to point
source at an empty directory.
// Create an empty directory first__dirnamesource'./empty'
metalsmith-dayone can filter which journals and entries get built by passing options to the plugin.
Let's say you have a journal called
Exercise with a ton of entries but you only want to build a site with entries tagged
bike. Here's how you'd do that:
Day One captures a lot of data. From
userActivity.stepCount, well there's a bunch. For this reason, this plugin doesn't do much data parsing except the following:
textto a buffer (and optionally parses it to
html) and puts it on
titlemetadata based on the best guess from the entry
Here's an example of some data after
metalsmith-dayone is done with it (with a
'entries/BC5CE1B78AFC4003A1BB0CF5593013C5.html':contents: Buffertext: '# Raw markdown\nStuff'title: 'Raw markdown'tags: 'tag' 'tag3'weather: ...location: ......'photos/123.jpeg':contents: Buffer'entries/E686072CCEE044948295B7C4CF5D1C42.html':contents: Buffertext: '!(/photos/123.jpeg)'title: 'Untitled' // No title for this entrytags: 'tag1' 'tag3'photos: ......
Path to your exported Day One data directory or
If this is not used, it will default to the
The path where each entry will be written.
:id will be replaced by the Day One entry id.
Specifiy a layout property to be used with each entry. Used for compatibility with
Whether to parse the text of each entry from markdown to html. Based on this property the extension of each file will be
String | [String, ...]
Filter which journals get built by doing a case insensitive match on the name of the journal.
By default all journals get built.
String | [String, ...]
Filter which entries get built by doing a case insensitive match on the entries' tags.
By default all entries get built.