Hosting My Pocket Archive
I published the export of my Pocket archive on this site. Below a short description how I made this with Jekyll (this site is generated by it). The basic gist of this post is to show how publishing this is (and also CSV is awesome).
The export of Pocket is in CSV format, which Jekyll handles well. Below an example:
title,url,time_added,tags,status
http://www.linfo.org/unix_philosophy.html,http://www.linfo.org/unix_philosophy.html,1484426802,,archive
Field Of Dreams,http://www.imdb.com/title/tt0097351/,1424351431,,archive
https://en.wikipedia.org/wiki/Community_of_practice,https://en.wikipedia.org/wiki/Community_of_practice,1450194942,,unread
The first row contains column names, which can be used in the Jekyll-template:
{% assign pocket_export = site.data.pocket_export | sort:'time_added' | reverse %}
<ul>
{% for row in pocket_export %}
<li>
<a href="{{row.url}}">{{row.title}}</a>
saved on <time data-timestamp="{{row.time_added}}">calculating...</time>
{% if row.tags %}<span class="tags">[{{row.tags}}]</span>{% endif %}
</li>
{% endfor %}
</ul>
The template is straight forward. It could be much more fancy, but I’m probably not using it much after this.
There was one snag though. The format of the time_added
in the export in seconds after the start of 1970.
I’ve used JavaScript for this to format the date.
<script>
document.addEventListener('DOMContentLoaded', function() {
let date = new Date();
for(let ts of document.querySelectorAll('[data-timestamp]')) {
date.setTime(ts.dataset.timestamp * 1000);
ts.setAttribute('datetime', date.toISOString());
ts.innerText = date.toLocaleString();
}
});
</script>
I could have pre-processed the export to include an ISO-8601 formatted date. That would give me the option to group the items per month, but for now I’m done (I mean, this topic is a sinkhole. I could stylize the tags. I could add filter options. Heck, I could even rebuild Pocket).
Sometimes it’s better to ship.