Ask HN: How to build a light weight personal blog?

52 points by rishikeshs ↗ HN
I've been running my personal blog for a while using WordPress, but I find it too buggy and loads slow.

I was thinking of redesigning and redeveloping my blog into a light static website. What are some alternatives to Wordpress that are fast and small? I don't really need a CMS as I write all my blog posts in markdown. I'm currently thinking of using Hugo or use some framework like Skeleton. Any other suggestions?

My current site: https://rishikeshs.com/

117 comments

[ 3.5 ms ] story [ 220 ms ] thread
I really like 11ty for this sort of thing.

It uses nunjucks templating but the starter is enough to just build a blog and add your own css.

Works with most hosts as it has a build script you can run and serve the output folder.

https://www.11ty.dev/

Edit: typo (css, not cms)

I write my blog in plain text files (because it's primarily intended for gopher), and then wrote a little node+express service that watches those text-files and applies a bit of regex to it to make links be links, and otherwise just formats it as html. Here's how it looks

http://dusted.dk/pages/phlog/2021-12-14.txt and http://dusted.dk/pages/phlog/2021-12-14.txt?raw

to inline an image, i just refer to the name, so lol.png becomes an <img src="lol.png"> in the html.

My main compromise is that if it makes the plaintext less pretty, it can't go in, no tags.

My inline code blocks is made by matching for a language or file name ending with: and if the next line is indented, it is considered code.

Look at http://dusted.dk/pages/phlog/2019-12-20.txt and the raw text http://dusted.dk/pages/phlog/2019-12-20.txt?raw

I used Astro with markdown files, with some Vue components for interactivity and search.
(comment deleted)
If you find it too slow you may want to try a cache plugin. I think automattic (the creators of Wordpress) have one.
This is one of those things where it's almost quicker to write a new SSG than to search through the thousands that are already out there. Depends which language(s) you prefer and are most comfortable with.
I am evaluating these options now:

- https://github.com/alaq/adrien.sh for NextJS

- https://github.com/sw-yx/swyxkit or Svelte

- https://github.com/SimeonGriggs/simeonGriggs for Remix

All have designs I like. I am only familiar with NextJS and find it a pleasure to work with.

Why all the JS/TS though? Part of what's great about a static site is serving simple HTML/CSS pages that look great, degrade gracefully, and don't hog users CPU/RAM like JS applets do.
With Next/Svelte/Remix you can only ship HTML/CSS if you want. Reason to use those frameworks is that I find their mental model to fit nicely for progressive enhancement. For my blog, I plan to have interactive content via MDX or something similar so there will always be optional JS involved.
Thanks for the clear answer. I've previously heard of server-side rendering for JS frameworks but i was certainly not aware that several frameworks supported it, and that some people like you actually cared :)
Take a look at nextjs it serves plain HTML and CSS then hydrates it with JavaScript interactive-ness
I rebuilt my personal site using Hugo a couple years ago and it’s been great. Super easy to write new posts in Markdown, flexible enough I could do anything I might need, but easy enough to build out just the features I need and no pressure to update anything for security reasons.
I use https://www.metalsmith.io/ for my site and it works great, but any static site generator will do the same. No comment functionality but that’s fine by me.

Static sites are cheap and easy to host. :)

I am very happy with Pelican, with isso for self-hosted comments.
Jekyll + GitHub Pages = Static blog with free hosting

You could substitute Jekyll for other supported frameworks.

Pros:

* Markdown (so super flexible)

* Git as the backbone (free CRM, free history)

* Customisable (if you know how to code)

* Free templates

Cons:

* Jekyll is a bit of a pain on Windows but should be fine on Linux/Mac

* Images might not load super quick from GitHub's servers

* You need to know basic Git

Another con: you depend on Microsoft's good will to serve your blog, as they own Github. That kind of workflow is amazing but you should probably consider going with a non-profit software forge that runs on donations and will protect (y)our interests (like codeberg.org for example).
GitHub sites were in place long before the acquisition. (I'm an MS FTE now, but have been using GitHub since the beginning and am a bit weirded out by this perception that corporate ownership is a taint of some kind.)
In my personal views, corporate ownership is mostly a bad thing. Although i can see how some corporations are very user-friendly and will go to great length to service their users. But i can't say Microsoft, who's always been engaged in very user-hostile practices, has a good track record.

Microsoft famously tried to outcompete the Internet via their existing monopoly on Windows with MSN (not just the messenger) back in the day, and have always been super hostile to free-software. They have also, like any corporation, stopped to maintain several services over the years and the fact that beyond their public image they don't have any incentive to keep Github Pages going doesn't inspire me confidence.

The fact that Github Pages were up and running before Microsoft's acquisition of Github is a reason to be worried. There's no money flowing in from that service and it probably costs a fair amount. Despite their "we love open source" statements, i've yet to see Microsoft open-sourcing any significant product (including Github) and specifying/standardizing existing stuff like Github Actions.

Well, in my personal view (since I joined coming from an OSS environment) you are still hanging on to _very_ ancient history. I won't discuss it further other than point out that the last six years have been completely at odds with that worldview and that software has changed profoundly (I recommend you check out the Azure GitHub org, where a _lot_ of tooling and supporting services are public).
Is Secure Boot ancient history? TPM 2.0 requirement? The quasi-requirement of a Microsoft account to use Windows? Ubiquitous telemetry that's impossible to disable? Cortana that cannot be removed and employs precarious workers without a confidentiality contract to transcribe everything people say and have no idea Cortana is recording? Blocking standards-compliant mail servers silently?

Microsoft is still a strong force for evil in this day and age. I only wish they were disbanded during the antitrust investigations of the 90s instead of putting Apple on life-support: the world of computing would be such a better place without both Apple and Microsoft to shit their monopoly on our faces.

As a Mac user working at Microsoft on Linux workloads, I definitely do not identify with that viewpoint.
Do you think the examples i presented are bullshit or do you not think they are ethical problems? Just because Microsoft embraces people working on different operating systems doesn't mean they suddenly started to respect the human rights of their users.
I would favor the first part of your sentence. I watched a lot of that happen before joining and understand how it happened, and I think you're inflating the matter.
You don't depend on Microsoft: Static sites can be moved easily to another provider if anything bad happens - there is no "vendor lock-in".
I thought Github Pages only worked with *.github.io but it appears you're correct and we can now own domains hosted by Github. So my original argument only stands for people using Github's domain instead of their own. Thanks for correction!
And there's so much competition in that space ( static site hosting) it's actually difficult to choose a provider, so if GitHub does something bad, you can switch in no time ( pending DNS propagation).
I personally use Jekyll for all my static website needs (including my homepage); probably better options out there (certainly newer ones), but I like that it's a first-class citizen for GitHub Pages (not relevant for my own homepage, which runs off a VPS in Iceland, but certainly relevant for the couple of FOSS projects of mine that have their own websites) and if it ain't broke, why fix it? Any similar static site generator should be right up your alley - Hugo included.

It's been a dream of mine to someday do everything via Emacs' Org Mode, but I haven't yet felt motivated enough to take the plunge.

This sounds like a job for Hugo, GitHub and Netlify.

Simple. Easy. Free.

You can even set up a form and get comments into your email. (Then just manually copy/paste into the markdown and commit it again and force a rebuild).

I use that setup and I love it.

> just manually

I would find this tedious for any number of comments. Is there a better way?

I’ve thought about writing a AWS Lambda that you POST the comment form to which then adds a file to the git repo that then Hugo can grab when Netlify is building the site, but that seems rather complex and I think it’d take me a lot more time than just doing it manually.

But I haven’t found a good, lightweight, privacy focussed way to solve this yet.

I'm also interested in this (although not AWS): what would be interesting would be a protocol-first approach where we can come up with several interoperable implementations. i personally would go with a simple PHP script, but i can see reasons for which someone would use another tech that's closer to the rest of their stack.
Don't host comments. The day when comments tended to have any value on the web passed ages ago. No one blogs anymore, and no one reads blogs anymore, so most of the traffic you get is just going to be bots or cancerous trolls anyway - if you're lucky enough to get any actual human readers at all in the latter case.

Or use a hosted service like Disqus or an alternative if you want comments, but the better solution is not to bother.

As someone who has a public email written on their blog, i've found the signal/noise ratio in the emails i reply to be very good. Of course, if you have a public HTTP form you're gonna have more SPAM, but most SPAM is fully automated and will not pass a simple "what's 2 + 2" CAPTCHA.

If you need better vetting, consider using webmention/ActivityPub federation and allowlisting individual hosts for automatic approval. There is definitely spam on such protocols too, but they tend to come from the same domain/IP so denylisting is very efficient in dealing with it.

Can't help thinking of the Yogi Berra quote (whether he said it or not), "Nobody goes there anymore, it's too crowded."

Seems like there are a lot of folks interested in blogging support, considering that nobody reads blogs anymore.

Jekyll, all the way.

Easy and free to get going on GitHub Pages.

A key take away from many years of running a blog as a static website is that may add friction to your process. Unless you have some sort of CI/CD going on, the chances are that one can only post from their own computer, while using something like Wordpress allows them to post from anywhere — including their mobile devices — which leads to a ton of serendipity.

You might want to evaluate if posting from multiple devices is important to you, and if you're willing to setup some process to do it with a static website. I'm not saying that it can be done, I'm just highlighting that it is not something you can automatically take for granted.

An option that you might want to consider is GravCMS[1] which is PHP based. It has an interactive app for admin and posting, but once you post it generates static files. So from the point of view of the server and your readers, your website is static. You can still post from anywhere though.

I'm sure there are other similar solutions, and that someone has a SaaS to solve this which they think it will be the next unicorn. Anyway, just another thing for you to consider.

[1]: https://getgrav.org/

I think the rise of static site generators has pretty much gotten rid of this as a problem.

Regarding posting only from your computer, you can just use a git repo that triggers builds on push.

You can see many options for them here https://jamstack.org/generators/

CI/CD pipelines is not exactly complicated, but how do you handle multi-user permissions on a git repository? You sure can with git hooks if you run your own git server, but with an integrated solution like Github it's simply impossible.

Some apps like Netlify (are there others?) presented solutions but are unfortunately to my knowledge not selfhostable.

I don't think most people would need multi-user permissions on a git repository for a personal blog, right? In my case, I just push to GitLab and have CI run to deploy to S3 via a GitLab-specific IAM user key/secret set as a repo env variable.
When i say multi-user i don't necessarily mean human users. Some bots could be pushing content like comments from 3rd party interfaces (email inbox, HN thread, HTTP form) and i wouldn't like them to have write access to content/ or themes/ folder, only to a dedicated folder.

Also interesting to question the whole supply chain security. What is Gitlab gets hacked? Surely you could deploy from/to your own infra using Gitlab as a source of truth by verifying PGP signatures (like with guix git-authenticate), but then how to apply the aforementioned ACLs? If you have resources on that topic, i'm all ears.

> When i say multi-user i don't necessarily mean human users. Some bots could be pushing content like comments from 3rd party interfaces

Could be easier to use either another repository or a 3rd party comment system like Disqus

I think this might be over-complicating it a bit for a personal blog. There are comment systems like Commento, Disqus, Hyvor, etc that let you just embed a JS snippet into your layout for comments (if one even wants to support blog comments at all).

Regarding GitLab getting hacked, while it is of course a concern I'm not sure it's any more of a concern compared to using any other hosted blog service. You'd have to consider how secure any hosting solution is, whether it's Wordpress, GitLab/AWS, Medium, or anything else. As a benefit, GitLab (unlike many other blog hosting services) supports U2F MFA.

I just do git push to post, the site generator does the rest (including diffs and optimized change rendering in my case).

You can git push from anything these days, including an iPad (which is basically what I do).

(edit: why the downvotes?)

Yes, that is what I said. It can be done, but it is not as trivial as posting on a wordpress-based blog. You have to setup some sort of CI/CD workflow and be able to do git stuff from other devices. It is up to the OP if they want to go through that route.
I've googled a bit on this issue and it seems like you can auto-deploy on post-push easily by using Git Hooks (https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) You just need a single simple bash script, no need for complex CI/CD stuff.

Still, you're right that doing git stuff on other devices can be a bit annoying. A web interface might be a lot more convenient if you want to edit your blog WYSIWYG on the fly.

Yeah it's me who made that SaaS but just as a handy tool for me to publish a static blog out of my google docs. It's live at https://hexo.press

P.S had no intention of becoming the next unicorn :)

Yes, it depends on what you want to achieve.

If you are looking to get an understanding of deployment models, gitops, hosting solutions, CSS, HTML, and maybe do some writing, choose the static hosting option.

If you are looking to write, choose wordpress, preferably hosted.

+1 for Grav: I've deployed it on my server and interact with it using the admin page and the git integration. It's simple and easily customizable, unlike WordPress. The main appeal of Grav, to me, is the hackability and ease of management compared to other CMS's. With a proper caching system, Grav is as fast as an SSG.
> Unless you have some sort of CI/CD going on, the chances are that one can only post from their own computer, while using something like Wordpress allows them to post from anywhere — including their mobile devices — which leads to a ton of serendipity.

There's a plug-in(s) for WP that allows you to have the GUI for convenience, but then generate a static site:

* https://wp2static.com

* https://www.wordpress.org/plugins/simply-static/

* https://www.wpexplorer.com/static-website-wordpress/

Either serve the static area directly, or use some scripting to update where your public web server lives.

I use Pelican mainly because if I ever need a plug-in to do something very particular, I'd rather use something I'm extremely familiar with (Python).

I host in Netlify with my own domain name.

Link in profile if interested.

I use hugo[1] for pilabor.com, heres my personal tutorial, how to build a blog from the scratch:

https://pilabor.com/blog/2021/05/building-a-blog-with-hugo/

Benefits:

- Write MarkDown for blog posts

- Integrate custom HTML, JS and CSS snippets

- Site search via JavaScript and JSON index file

- Integrate data files (like auto replace affiliate links, content table building or dynamic image resizing)

- Very fast site generation

- Image Processing features

- HTML, CSS and JS minification

- One single binary that runs nearly everywhere (e.g. on Raspberry PI)

[1] https://gohugo.io/

I switched to Nikola recently: https://getnikola.com/

Reads every kind of plaintext format, but will also just publish a Jupyter notebook which means you can do drag and drop image and graph inlining which makes everything so much simpler (and thus makes me more likely to keep it up).

Also single command GitHub pages publishing.

Write the post in markdown then convert them to HTML with pandoc. Write a bash script which walk into every directory to convert and you have a minimalist blog engine.
This is what I do. Pandoc to convert the markdown files into standalone HTML files. I use a custom HTML template to style the page a bit and add meta tags etc.
I use Hugo. Lots of free themes here: https://themes.gohugo.io/

You can write your content in Markdown, keep everything in a repo, and only push static files to the hosting of your preference.

I use Zola[1]. Single binary, simple structure, minimal frontmatter.

1. https://getzola.org

zola is great! Some caveats: full translations still require workarounds, and nested macros are not a thing. But it's making great progress and certainly tera templates (jinja-like) are much easier to deal with than go templates.