Blogging with DayOne and bucket3
When I first started bucket3, I wanted it to be a tool that could integrate nicely with other unix command-line tools. Bucket3 would only take markdown files and convert them to a static HTML blog.
The markdown files would initially be created and edited in a text editor, but I had in mind that in the future, there might be other ways to create them.
Well, a couple of days ago, I wrote a script that generates posts from DayOne entries.
DayOne "is a journaling platform to record and preserve your memories for the long term". It runs on OS X and iOS and is able to sync your journal between devices using iCloud of Dropbox. Your journal is private, it's not published anywhere. And entries can contain text (markdown too!) and photos.
The nice thing with DayOne is that each journal entry is actually a property list in XML.
So, I wrote a quick'n'dirty dayone-to-b3.py that does the following:
- goes through all DayOne entries and checks if some of them have the tag "blog"
- for these entries, it creates a new bucket3 post
- if there is a corresponding photo, it is also copied in the bucket3 post directory and "attached" to the post using the
attached:
property in the post's front matter.
A bucket3 post generated by dayone-to-b3.py looks like this
---
title: >
preparing for an exciting week.
date: 2013-09-30 08:42:36
slug: preparing-for-an-exciting-week-
tags: en, longaccess
attached: 6B77B0B1C8BC4DFEAA6D3589973848DD.jpg
location:
locality: Athens
country: Greece
place: Athinas 39–49
long: 23.7269058
lat: 37.9796632
weather:
C: 27
F: 81
description: Sunny
icon: sunny.png
---
![photo](6B77B0B1C8BC4DFEAA6D3589973848DD.jpg)
Shooting profile photos for our new website at [longaccess.com](http://www.longaccess.com)
DayOne, has a couple of very nice features. One of them is that it can add location and weather data to each journal entry. dayone-to-b3.py takes advantage of this and adds this data to the bucket3 post's front matter.
All properties described in a bucket3 post front matter are available in the (jinja2) templates under the object meta
. So, my post.html
template has something like this:
{% if meta.weather %} on a {{ meta.weather.description|lower }} ({{ meta.weather.C }}°C) {{ meta.date.strftime("%A") }}{% endif %}
that will generate something like "on a sunny (27°C) Monday"
An other nice thing is that I can use my iPhone to write DayOne entries. I can also use it to shoot photos and add them to my journal. These entries are synced to my mac mini and my macbook and there I can use my script to "export" these entries and "import" them to bucket3. It may sound complicated but it is actually done by running:
$ dayone-to-bucket3.py
$ bucket3 update
As I said, I only send to my blog DayOne entries that are tagged "blog". This way I can keep a private journal, and if I want to publish something I just tag it.
Plus, I know that even if I stop using DayOne, I can always export all entries (not just the ones tagged "blog") and create a private blog, in HTML, viewable by any browser. (OK, if you are worried about lock-in, the DayOne app will also export you entire journal in a nice PDF doc.)
For the record: this post was entirely written in DayOne :-)