2024 New Blog Theme
This blog is managed in a private git repository. Posts are created in markdown format and a program called Hugo takes those files and generates a set of HTML and CSS files necessary to run a website on a web server. Instead of using a Hugo theme made by someone else, I have created my own theme that is more lightweight and I will be able to maintain.
Previous theme
The previous theme used:
There is an a previous post that walks through configuring this blog with that old theme.
New theme
The content for this blog is all in markdown files. After a few changes to config files, the new theme applies to the existing blog and retains the content from before. Below I can walk through creating a blog themed site with Hugo and the theme used by this site.
ajsTheme
I have created a theme using bootstrap and it is available on GitHub
Example blog
I have uploaded an example hugo blog on my personal gitlab profile. Check that out for the theme configuration.
Prerequisites: Hugo and git
Both of these programs are available for macOS, Linux, and Windows.
Optional: Create a new site
Once hugo is installed, create a new site by typing the following command into your shell:
|
|
This will create some new directories for use with hugo.
Alternative
Alternatively, you can download the example blog from my GitLab. If you do that do not run the command above to create a new site.
Add a theme to the site
Now that the skeleton structure of the site has been created, here is how to add the same theme that is used by this blog:
|
|
Replace $giturl
with the git url of the theme you want to use. The theme I created can be used.
Replace $themename
with the name of the theme you have chosen. Usually this would be the name of the git repo for the theme.
In powershell the commands should be the same but always press
Configure the site
The default config file config.toml
can be deleted. Next create a directory called config
and then _default
within.
|
|
In powershell:
|
|
Within this new directory, create files to configure the hugo theme:
config.toml
: This is the main hugo configuration.menus.toml
: This is the config for toolbar menu on the site.
config.toml
Basic example that is included in the git repo:
|
|
Add content
In this example, new pages in English are added to the directory content
. The first file added should be _index.md
.
|
|
Create a new post:
|
|
Updating theme
A theme for Hugo sites can be a git submodule that is updated with the following command:
|
|
Test the site
Run the following command to test the site on your local machine. The web server will be available at localhost
port 1313
.
|
|
You can view the site in your browser:
http://127.0.0.1:1313
Dark theme:
Conclusion
I plan to continue developing the theme. Some features that I am looking to add:
- Search function
- Refine style of metadata like tags and categories.
- Eventually move away from bootstrap framework to something more lightweight.
- Post view should show an image from the post