Posts

Online blogging with Decap

Nov 4, 2023 | 3 minutes to read

I’ve had this blog for a couple of years and so far, when I wanted to make a new post, I had to:

  • Sit down at my home PC, get into my text editor.
  • Create a Markdown file, preview that a bunch, tweak it until it’s just right.
  • Then use git to commit and push that into my cloud-based git repo.
  • From there, the post is magically posts to my web site and it shows up here for the world to read.

That’s been fine but I wanted to know if there is a way for me to post from this web site itself, from anywhere - and it turns out there is.

Big, complicated web sites have what is called a “CMS” - a Content Management System. Since this web site was created by and for me alone, I don’t need all the functionality that comes with a CMS, but I did still want this one function - online post creation and editing. The tool I found - Decap CMS - is just what I need and nothing else.

With Decap, I can publish to my blog via this process now:

  • Visit my web site, log in there.
  • Click Create Post
  • Start typing… add images and links and whatever else I need (music, video, etc…)
  • Click Publish.
  • Wait a few minutes and boom. My words are online.

Adding Decap to my static hugo web site was really simple:

  • Create a folder at /static/(secret administration folder name)
  • Create an “index.html” file in there and give that the contents as shown on this page.
  • Create a “config.yml” file in there and give it the contents from the same page.
  • That same instruction page tells you to create a index.html file in the /layouts/ folder but for my Hugo site’s theme, that didn’t work since it doesn’t have a file there by design.
  • So I found and edited the file at /themes/introduction/layouts/index.html and inserted this line into that file:
    <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
  • Save all those files.
  • Commit and push those updates to my cloud git repo.
  • Let my web host pick those up and publish them to the public site.

Getting it running on the web site was simple too:

  • Visit my web site, access the administrative login page.
  • Sign up for a new user account.
  • Confirm my email address is legit via their confirmation email in my client software.
  • Log in to the site and start working.

This is all working now and I like writing in the Decap editor just fine so I think I will use this from now on.


You can leave a comment on this post here.