Live data from Hacker News

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

news.ycombinator.com

21–30 of 115 posts

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

#21
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/

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

#22
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.

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

#27

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?

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

#28
I write some of the most popular content on Hacker News. My HTML pages have an similarly austere style to what you might expect from Dan Luu or Fabrice Bellard. However I make an effort to give them a slightly more distinctive modern feel, while loading just about equally fast. Here's how I do it.

Example: https://justine.lol/sectorlisp2/

First, I like Roboto. It's overused but it deserves to be. It's the Helvetica of our age. The problem is custom fonts go slow. The trick I use is to use a data: uri for the latin1 character ranges in an inline tag at the very top of the page, so that the top portion of the article can start rendering immediately.

    
    @font-face{font-family:'Roboto';src:url(data:font/woff2;base64,d09GMgABAAA...
    html{font-family:Roboto,sans-serif;font-size:14pt}body{max-width:960px,...
    
The only tools you need to do stuff like this are really uglifycss and uglifyjs. Plus maybe a shell script that runs files through `openssl base64`.

To save on bandwidth fees, I've learned to defer autoplay videos until they scroll into the viewport. See http://justine.lol/sectorlisp2/video.js to learn how.

When copying to google cloud storage cdn it's a good idea to use the `-z` flag so content can be delivered with gzip encoding.

    gsutil -m -h Cache-Control:public,max-age=31536000 cp -a public-read -z com,dbg,css,html,a,h,lds,o,js,ttf *.js *.css gs://justine/sectorlisp2/
It's nice to not force people to use https. Dan Luu talks about the reasons why on his blog.

Be sure to use tools like https://pagespeed.web.dev/ which will help you with the rest.

Another good tool is https://favicon.io/favicon-generator/ for generating favicons. I'm very happy with it. I'm also a huge fan of https://excalidraw.com/ and graphviz https://dreampuf.github.io/GraphvizOnline/ Also I'd give a shoutout to the optipng and pngcrush commands. PNG-8 is fabulous. So is Photoshop.

Finally, for something like a blog, consider just writing HTML. Your time is better spent learning how to be really efficient at using an editor like Emacs that lets you be a monster with manual refactorings than you would with a static site generator framework, which are usually heavyweight and frequently change in ways that causes breakages and have lots of weird dependencies. I don't think they're the sorts of things that can be counted on if you need to go back ten years later.

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

#29

Replaced my Octopress blog with 200 lines of babashka (Clojure) and blogged about it here: - https://blog.michielborkent.nl/migrating-octopress-to-babash... - https://blog.michielborkent.nl/better-clojure-highlighting.h... - https://blog.michielborkent.nl/markdown-clj-babashka-compati...

> "Figwheel keep Om turning!"

Love the musical word play. Nicely done :)

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

#30
post #27

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.

Post reply on HN