Zuperkülblog (Progressive) - Hugo Edition
A Progressive Web App built with Polymer, backed with Hugo for post management.
Why?
Experimenting with progressive app shells and CMS. That, and decause I don't want to write posts in JSON. ;-)
Prerequisites
Things you're going to need:
Setup and run
➜ git clone git@github.com:justinribeiro/zuperkulblog-progressive-hugo.git
➜ cd zuperkulblog-progressive-hugo
➜ npm install && bower install
➜ gulp
➜ dev_appserver.py .
Nuts and Bolts
- Hugo feeds into the app shell; you write your posts normally in Hugo in
content/content/
using the same front matter you'd normally use (in this case, I used TOML). - The
gulp
task is what fireshugo
to build the static JSON files from the posts you've created in Hugo. - Our gulp task is extended to do some heavy lifting; it takes the
*.html
that Hugo generates and renames to*.json
. - Hugo itself won't generate JSON, but we can use generate our own JSON by creating the proper template layouts in
_default
. - Since Hugo doesn't give us access to
toJSStr
, we get around this by simply dumping our post content to safe string we can use in JSON. We'll let Polymer handle it. - We update
app.js
to take into account the change in routes of where the json exists. Example:/data/art.json > /data/art/index.json
- We update our
article-detail.html
element to observearticle.content
and make sure it properly handles our safe html.
All in all, not too complicated really.
Thinking outloud
- Need to deal with pulling RSS and proper sitemap.xml from Hugo into
dist/
(temporary shuffle solution for now) - sw-precache probably shouldn't cache every blog post (your blog may have many). We'd need to be smarter about how much data gets initially loaded.
- Probably should work on a PR to Hugo to have cleaner method to generate JSON directly via front matter object (was some talk on mailing list about JSON, but can't find ticket at moment for 0.16)