Blogging with next.js

For a long time I’ve wanted to blog more regularly, but haven’t been able to update my website. Which I mean literally. It had bitrotted to the point where I couldn’t remember how to build and update it anymore. Then when I saw the next.js announcement I knew it could get me unstuck. The same day I pushed the first commit in what is now my blog (that you’re reading on).

Getting Started

Next is a triumph of convention over configuration. To make a home page it’s as simple as creating pages/index.js which exports a function returning its content. Same for the page you’re reading. Styling is simple with styled-jsx. For the first time ever I have an SSL certificate (because it’s built-in so I didn’t have to figure it out myself). Next provides server-rendering of my pages and page pre-fetching. Making this work with markdown was a line or five of configuration. GA integration also easy Embedding js easy, don’t have to webpack

What’s Missing

The biggest drawback: I just introduced a bunch of dead links to the web. joelburget.com/plaintext is still sitting, unstyled, in an s3 bucket, as are a bunch of other pages. I’m planning to bring them back soon, but it’s a lot of work for the ones that included javascript. Writing in just markdown. With next, pages are defined by placing a .js file in the pages directory. I’m writing in markdown, so my js file just wraps the markdown content. RSS. Automatic feed generation would be 👌🏻. AMP. As a blog this is just a collection of static pages, which should make it easy to AMP. But it’s more work than just a meta tag. You need to swap in tags like <amp-img> for <img>, make sure you’re not using disallowed styles , etc. More work than I’m prepared to do for what’s essentially just a nice-to-have. There’s an open issue on the next repo to add an AMP example, after which the biggest remaining unknown is creating valid AMP content from markdown. Comments. I don’t have them but vaguely want them. Maintenance. This setup is rather minimal, but as soon as I start adding some of these features I’m going to be burdened with maintenance. I’d rather reuse someone else’s work. A couple potential candidates: Guillermo Rauch has also been blogging on next with an open source setup, which I’m hoping will evolve into a framework. There’s also a site generator called hokusai I’ve been keeping an eye on. This one shares a lot of the same tech we’re using, but isn’t targeted at next / now. I’m sure I can learn from both but am still waiting for someone to build the perfect next blogging framework.

Conclusion

Not everything is perfect, but next has been a great 80 / 20 solution to get me blogging again.