By adding Hugo Admonitions to your website so you can easily add stylish note bars for things like tips, warnings, cautions, important information etc. You can do this quickly and easily directly using markdown.
I used this feature with other systems and when looking into how to do this with Hugo I found blog/forum posts linking to a deleted github repo and for this reason I have decided to include the files inside my Hugo Website rather then using Hugo Modules or git submodules. This way I always have a working copy that I control and less risk of my website breaking due to deleted github repos.
Downloading the GitHub repo and preparing it for inclusion to your Hugo website
Outside of your hugo installation run the following command:
git clone git@github.com:KKKZOZ/hugo-admonitions.git themes/hugo-admonitions --depth=1
Now you need to delete the .git and .github directories from the theme download so it does not conflict with your repo.
rm -Rf themes/hugo-admonitions/.git
rm -Rf themes/hugo-admonitions/.github
Now you can copy the Hugo Admonitions theme into your Hugo website.
cp -Rf themes/hugo-admonitions /your/hugo/path/themes
cd /your/hugo/path
Registering the Hugo Admonitions Theme
Inside your Hugo root directory edit your hugo.toml configuration file and set the theme to be the following:
theme = ['hugo-admonitions', 'your-theme-name']
The Hugo Admonitions theme must appear before your main theme. This allows Hugo to load the admonition shortcodes and styles first.
You should now be able to use Hugo Admonitions inside your markdown files.
Example Usage
I am going to provide a large list of the options that can be used. First you will see what it looks like on the website then you will see the markdown code on how to use them.
For a full list you should check out the Hugo Admonitions GitHub Demos at https://github.com/KKKZOZ/hugo-admonitions/blob/main/docs/content/demo.md?plain=1
GitHub Style
Useful information that users should know, even when skimming content.
> [!NOTE]
> Useful information that users should know, even when skimming content.
Helpful advice for doing things better or more easily.
> [!TIP]
> Helpful advice for doing things better or more easily.
Key information users need to know to achieve their goal.
> [!IMPORTANT]
> Key information users need to know to achieve their goal.
Urgent info that needs immediate user attention to avoid problems.
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.
Advises about risks or negative outcomes of certain actions.
> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
Callout Style
Abstract: This paper discusses the advantages and challenges of microservice architecture.
> [!ABSTRACT]
> Abstract: This paper discusses the advantages and challenges of microservice architecture.
Advises about risks or negative outcomes of certain actions.
> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
Code snippet:
function fetchData() {
return axios.get('/api/data');
}
> [!CODE]
> Code snippet:
>
> ```javascript
> function fetchData() {
> return axios.get('/api/data');
> }
> ```
Conclusion: Based on the analysis above, we’ve decided to implement Docker containerization.
> [!CONCLUSION]
> Conclusion: Based on the analysis above, we've decided to implement Docker containerization.
Danger! Critical security vulnerability detected in the system. Immediate action required.
> [!DANGER]
> Danger! Critical security vulnerability detected in the system. Immediate action required.
Error: Unable to connect to database. Please check your connection settings.
> [!ERROR]
> Error: Unable to connect to database. Please check your connection settings.
Example:
def hello_world():
print("Hello, World!")
> [!EXAMPLE]
> Example:
>
> ```python
> def hello_world():
> print("Hello, World!")
> ```
Experiment: Testing the impact of new caching strategies on system performance.
> [!EXPERIMENT]
> Experiment: Testing the impact of new caching strategies on system performance.
Goal: Reduce service response time by 30% by the end of this quarter.
> [!GOAL]
> Goal: Reduce service response time by 30% by the end of this quarter.
Idea: Implement a machine learning-based code quality detection system.
> [!IDEA]
> Idea: Implement a machine learning-based code quality detection system.
Congratulations! Your code has been successfully deployed to production.
> [!SUCCESS]
> Congratulations! Your code has been successfully deployed to production.
To-do list:
- Update documentation
- Deploy new version
> [!TASK]
> To-do list:
> - Update documentation
> - Deploy new version
Helpful advice for doing things better or more easily.
> [!TIP]
> Helpful advice for doing things better or more easily.
Urgent info that needs immediate user attention to avoid problems.
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.
Header Only Style
> [!ABSTRACT] This paper discusses the advantages of microservice architecture
> [!CAUTION] Ensure all tests pass before merging to main branch
npm install
to install all dependencies> [!CODE] Execute `npm install` to install all dependencies
> [!CONCLUSION] We've decided to implement Docker containerization
> [!DANGER] Critical security vulnerability detected in the system
> [!ERROR] Error: Unable to connect to database. Please check your connection settings
> [!EXAMPLE] Git commit message format: "feat: add user authentication"
> [!EXPERIMENT] Testing new caching strategy with Redis
> [!GOAL] Reduce service response time by 30% by the end of this quarter
> [!IDEA] Implement a machine learning-based code quality detection system
> [!IMPORTANT] Please review and update your security settings
> [!INFO] Current system status: All services are operating normally with 99.9% uptime
> [!MEMO] Technical review meeting scheduled for next Tuesday at 2:00 PM
> [!NOTE] Always backup your data before performing system updates
> [!NOTIFY] System notification: Your password will expire in 30 days
> [!QUESTION] How can we optimize database query performance?
> [!QUOTE] "Code is like humor. When you have to explain it, it's bad." - Cory House
> [!SUCCESS] Congratulations! Your code has been successfully deployed to production
> [!TASK] Review and update API documentation by Friday
Ctrl + C
to quickly terminate a running program> [!TIP] Use `Ctrl + C` to quickly terminate a running program
> [!WARNING] Warning: This operation will delete all data
Conclusion
If you have set this up correctly then you should be able to use Hugo Admonitions in your markdown to quickly and easily create stylish note bars.
Tags:
Latest Blog Posts:
How to Setup Hugo Admonitions (Markdown Callouts in Hugo)
By adding Hugo Admonitions to your website so you can easily add stylish note bars for things like tips, warnings, cautions, important information etc. You can do this quickly and easily directly using markdown.
How to setup Syntax Highlighting with Copy Button using Hugo
In this post, I’ll show you how to add syntax highlighting and a ‘Copy’ button to your Hugo code blocks using a single self-contained JavaScript file. You’ll be able to highlight code in multiple languages, optionally show line numbers, and let users copy snippets with one click.
How to strip unused CSS from your CSS files and Minify them into a single CSS file using Hugo
Using Hugo with PostCSS and PurgeCSS allows you to automatically remove unused CSS and bundle all your styles into a single minified file for production, improving page load times and performance.
Make an application always load as a floating window in Cosmic Desktop
Make an application always load as a floating window in Cosmic Desktop
Why I migrated from Wordpress to Hugo
My reasons for migrating from Wordpress to the Hugo static website generator
Using Gtk4 With C# and Gir.Core Box Layout Tutorial
In this box layout tutorial, you will learn how to build a C# Gtk Application that makes use of the box layout to display multiple widgets both vertically and horizontally. You will also learn how to use a box layout to display an icon and a label inside a Gtk.Button widget.
Using Gtk4 With C# and Gir.Core Hello World Tutorial
In this hello world tutorial you will learn how to build a basic C# Gtk Application with a single Gtk Button widget inside it
Fix Unity Game Engine Crashing With Nvidia Graphics Card
A couple of years ago I was having issues with the Unity Editor randomly crashing on me. I tried many thing such as
prime-run
etc without success.I found through trial and error from multiple forum posts that launching Unity Hub with the following worked well for me and stoped the random crashing issues.
I am posting this just in case I need it again and hopefully others will find it helpful.
Adventure Game Studio AGS MacOS Build
How to play windows AGS games in a MacOS AGS Bundle and how to release your own games in a MacOS AGS Bundle with codesigning and notorization