Skip to content

dminca/dminca.github.io

Repository files navigation

Personal blog Deploy Hugo site to Pages

Initial setup

On a first clone, you'd wanna do it this way

git clone -b hugo https://codeberg.org/dminca/pages.git

Then we have to pull the theme which is installed with hugo

hugo mod get -u

Local development

Before pushing on the hugo branch which is our 'production' (so-to-speak), you'd wanna test out your changes quickly locally.

After adding content or modifying anything in the blog, compile it

hugo --gc --buildDrafts --minify

This makes sure that the blog can be rendered and it's also compacting the CSS and JavaScript in order to have a smaller footprint on the web.

Run the server locally and see how it looks

hugo serve --buildDrafts -p 8080

Now head-off to http://localhost:8080 and check if all okay

Assets (media and all that)

They're tracked with git-lfs which I've installed via

brew install git-lfs

And then initialised it

git lfs install

Tracking files

git lfs track "*.png"

Commit the .gitattributes file and done.

How does the CI handle that?

That flag's enabled by default in Woodpecker CI

Troubleshooting

template for shortcode not found

> ~/P/c/d/pages on hugo ◦ hugo -D --gc --minify && hugo serve --gc -D -p 8080
Start building sites … 
hugo v0.101.0+extended darwin/arm64 BuildDate=unknown
Error: Error building site: "/Users/dminca/Projects/codeberg.org/dminca/pages/content/posts/awesome-foss-tooling.md:24:1": failed to extract shortcode: template for shortcode "button" not found
Total in 47 ms

Can be resolved by clearing the hugo module cache

hugo mod clean

Releases

No releases published

Packages

No packages published

Languages