Today I Learned
Short notes on things I’ve learned recently. These are brief insights, code snippets, or concepts that I found interesting or useful.
Hugo overlay filesystem doesn't support nesting
Hugo has virtual overlay filesystem.
It gives you a way to mount directories.
You can see the mounts with hugo config
.
Today I tried mounting the sub-directories into the
assets
and static
, and while results were promising
at first, the outcome was deceiving. Only the first
mount was working OK. Overlays in Hugo don’t support
nesting.
Stashing Specific Files in Git
Today I learned how to stash specific files in Git instead of stashing all changes.
The Problem
Sometimes you’re working on multiple changes but only want to stash some of them. The standard git stash
command stashes all modified files, which isn’t always what you want.
The Solution
You can use the git stash push
command with specific file paths:
git stash push -m "My partial stash" path/to/file1.txt path/to/file2.js
This will only stash the changes to the specified files, leaving other modified files in your working directory.
Creating Custom Hugo Shortcodes
Today I learned how to create custom shortcodes in Hugo to make content creation more efficient.
What are Shortcodes?
Shortcodes are simple snippets inside your content files that Hugo will render using predefined templates. They’re a great way to add custom HTML or reusable components without writing raw HTML in your Markdown files.
Creating a Basic Shortcode
To create a shortcode, add an HTML file to the layouts/shortcodes/
directory. For example, to create a “notice” shortcode: