A lot has changed in the past year with how my website operates. It used to be just hand-crafted HTML and text files for blog posts, and then I moved to a preprocessor that would generate HTML, and I, for the most part, wrote my blog posts in HTML. Now, I don't do any of that. I was going to write a post about how I switched to Grav, but never got around to it. The gist is that I already run PHP on my server for my Nextcloud instance, so it really don't add any overhead, and being a proper CMS, it made managing pages and blog posts so much easier.

Additionally, even though Grav is a full-fledged CMS, it is extremely lightweight, because it doesn't require a database and everything is written in Markdown, which I have taken quite a liking to. I enjoy writing in Markdown because it allows me to style my writing without actually being distracting. HTML and other markup languages have far too much syntactic overhead that it causes me to get distracted and focus less on the writing.

So now that I am using Grav, the way I write blog posts has changed significantly, and honestly, I quite like it. Publishing posts is now as easy as opening up my text editor on my computer and then saving a Markdown file. In this post, I just want to jot down how I achieved that.

It's really quite simple, and I can probably explain it in fewer words than I used to introduce the topic of this post in the first place. Basically, I set up an External Storage location in my Nextcloud that is a local folder that points to Grav's user folder. That way, all my website data and configuration is available in my Nextcloud. Then, in my Nextcloud client, I instruct it to sync that website folder, so now my website lives locally on my laptop and gets automatically synced to Nextcloud—and therefore automatically published to Grav—whenever I make a change.

This setup allows me to just navigate to my website folder, create a new Markdown file, and open it in my Markdown editor of choice. Then, when I save the file with published: true in the frontmatter, it is automatically made live on my website. It really couldn't get any simpler than that. My Markdown editor of choice these days is MarkText, because it strikes the perfect balance of being WYSIWYG and also letting me type the Markdown syntax to get the styling that I want. I used to use NeoVim, and that was really nice too; I am particularly fond of the command line, but since I'm using MacOS these days, I've had access to a lot more applications, and MarkText is just one of them. It is clean, elegant, and stays out of my way. It removes the Markdown syntax and renders it after I've typed it, so it makes proof-reading much easier than in NeoVim, because I can see my writing rendered right in my editor; I don't have to run it through pandoc or something first.

I actually didn't start using MarkText and Nextcloud when I started with Grav. I started with the Admin plugin for Grav, which lets you manage the entire site directly on the web with a nice GUI instead of manually writing Markdown frontmatter and YAML config files. That was nice, but once I got the hang of Grav, I really didn't need it anymore, and it presents a security vulnerability because it provided its own login mechanism, which I don't need if I can just SSH into my server to edit files. I also really didn't like the Markdown editor in the Admin plugin. It didn't even have line numbers, I had to click a button to get previews, and overall it was just not a pleasant experience. It was basically an HTML textarea, and it made writing not very nice. Writing in MarkText is much, much nicer.

So that's how I write blog posts now. I write them in Markdown with MarkText, and when I save them, they get synced up to my server via Nextcloud and then Grav picks them up and publishes them. It has made managing my website literally just as easy as managing my personal Documents folder, because I am essentially just manipulating files and folders locally on my laptop, and the changes I make are automatically propagated to my website. Pretty easy, and also very nifty.

Previous Post Next Post