Skip to content

Latest commit

 

History

History
74 lines (49 loc) · 2.71 KB

README.md

File metadata and controls

74 lines (49 loc) · 2.71 KB

My Blog

Bits By Me uses the blog uses the hugo static site generator. Publishing articles is easy; working with Jupyter notebooks that become embedded GitHub gists is slightly more involved.

Prerequisites

The easiest way to start is to use a GitHub Codespace or run locally as a devcontainer in VS Code (see devcontainer.json for details).

If you must use locally then you need to install:

  • Go - I use asdf so asdf install golang latest works for me.
  • Hugo - brew install hugo
  • Task - go install github.com/go-task/task/v3/cmd/task@latest && asdf reshim.

Author and publish

Write a new blog post by providing a TITLE and calling the task blog:

TITLE="some-factoid" task blog
...write write write...
git add .
git commit -m "my cool post"
git push origin master

You do the roughly the same thing for Today I Learned posts but you don't provide a TITLE.

task today-i-learned
OR
task til

Each post is put into a folder like til/1971-01-01/ or blog/1971-01-01/awesome-title with an index.md file. This gives you a spot to drop post-specific content next to the post itself. For example, if you want an image for a post you can drop it in that folder and reference it in the post thus:

Hosting

The blog itself is hosting on GitHub Pages. The DNS configuration is in Squarespace Domains accessible using my personal Google account.

Preview

  • If you're running in Codespaces or a Devcontainer you should already have a preview running on port 1313.

  • If you're doing things manually, start a dev server by running task. That starts the default task, the dev server:

    task

Look at the draft Tips post to see examples of how you can use various elements like diagrams, code, and tweets.

If you want to publish and put all the non-draft content into the public/ directory just type hugo on its own.

Content pre-processing

Shrink PNGs

Following this advice it's a good idea to squish PNG images down before adding to Git or the blog. I'm seeing results like a reduction from 480kb to 70kb.

One time:

brew install pngquant oxipng

Then use like so, passing in the name of a content directory containing PNGs to squish:

pngquant --quality 20-50 content/til/2021-03-31/*.png
oxipng -o 3 -i 0 --strip safe content/til/2021-03-31/*-fs8.png