Migrating to Hugo

Using Sapper and Strapi

Currently I am in the process of converting my blog to a Sapper blog that will be statically exported to Netlify. The local headless CMS was built using Strapi. The tutorial I followed for this was pretty straight forward.

There are two small things I’d add though.

For one Strapi uses markdown and Sapper is going to render in html. I’d download the “marked” package and import it into in svelte file that will require markdown conversion.

npm install marked

For the [slug].svelte file in the articles folder of the tutorial, at the head of the document you’d add:

import marked from 'marked';

From there, you’d simply have the “marked” function take in the body of your posts as the parameter:

{#each post as post}
  <h3>{moment().to(post.Published)} by {post.author.username}</h3>

  <div class="content">
    {@html marked(post.Body)}

Besides this my main blog is now on Hugo. I decided to use the codex them for now. I’ll probably tweak it as time goes on.