My personal website created with Hugo and the PaperMod theme. Deployed to GitHub Pages with Github Actions.
This is just a section for myself to remember how to use Hugo.
Inside the folder of your Hugo site MyFreshWebsite, run:
git submodule add --depth=1 https://github.com/<dev>/<name>.git themes/<name>
git submodule update --init --recursive # needed when you reclone your repo (submodules may not get cloned automatically)
Then set the theme in the .toml/.yaml config file.
Inside the folder of your Hugo site MyFreshWebsite, run:
git submodule update --remote --merge
To create a new post, use the following command:
hugo new content content/<directory>/<post-name>.md
Hugo created the file in the content/posts directory. Open the file with your editor.
By default the file is added as draft and looks like this:
+++
title = 'My First Post'
date = 2024-01-14T07:07:07+01:00
draft = true
+++
The content of the file is written in markdown under the front matter. Draft needs to be set to false to publish the post.
Archetypes contains templates. I have used a template for posts from PaperMod.
Use this template when creating a post by using the following command:
hugo new --kind post content/<directory>/<post-name>.md
To run the server, use the following command:
hugo server -D
The -D flag is used to show drafts.
The server is by default running in Fast Render Mode. For full rebuilds on change:
hugo server --disableFastRender
Sometimes the cache needs to be cleared for the server to update:
hugo --ignoreCache
This walkthrough is only for themes installed as a git submodule.
- Remove the submodule entry from .gitmodules:
[submodule "themes/<name>"]
path = themes/<name>
url = https://github.com/example/name.git
- Remove the submodule from the .git/config:
git submodule deinit -f themes/<name>
- Remove the submodule directory:
rm -rf .git/modules/themes/<name>
rm -rf themes/<name>
- Remove the submodule entry from the index:
git rm -f themes/<name>