Intro #
Ok, so check this out this is a demo page. I just slapped up some markup here to test some things. This is a static site generated with Hugo™️ using a theme with a lot of different features. I’m going to try to set something up to deploy this via a git repo. The idea is that I can open the repo type me little words and then automatically have the website deploy those changes. I think I should be able to do this with github actions. I’m going to use this article as kind of a meta-explainer for the process.
You are here #
So far I’ve installed Hugo and a theme called blowfish and congigured some basic features. I also created my first article which I’m typing in. Hello 👋
I also figured out how to use shortcodes and markdown to add extra bits to the page. Some of it can be seen in the next section.
A Brief Intermisssion #
This is a paragraph with bold and italic text.
Check more at Blowfish documentation
Personal Website & Blog Theme for Hugo
There is built-in support for LaTex but I probably won’t need that. Me and higher level math are enemies.
$$ f(a,b,c) = (a^2+b^2+c^2)^3 $$
I did a little bit of configuration to update the codeblock syntax highlighting to match my current vs code theme, catpuccin. Here are some code snippets.
Here’s some Rust 🦀 #
// This is a code example
fn inc(n: &mut i32) {
*n += 1;
}
fn main() {
println!("Hello World!");
}
Some More Rust #
use colors_transform::{Hsl, Color};
use colored::Colorize;
pub fn rainbow_print(message: &str, frequency: Option<u32>) -> () {
let mut hsv = Hsl::from(0.0, 100.0, 75.0);
let frequency = match frequency {
Some(f) => f as f32,
None => message.len() as f32,
};
let increment = 360.0 / frequency;
for ch in message.chars() {
hsv = hsv.set_hue(hsv.get_hue() + increment);
let c = hsv.to_rgb();
let rgb = (c.get_red() as u8, c.get_green() as u8, c.get_blue() as u8);
print!("{}", ch.to_string().truecolor(rgb.0, rgb.1, rgb.2).underline());
}
}
#[macro_export]
macro_rules! rainbow_println {
($message:expr) => {
rainbow_print($message, None);
println!();
};
($message:expr, $frequency:expr) => {
rainbow_print($message, Some($frequency));
println!();
};
}
#[macro_export]
macro_rules! rainbow_print {
($message:expr) => {
rainbow_print($message, None);
};
($message:expr, $frequency:expr) => {
rainbow_print($message, Some($frequency));
};
}
Automation! #
Now with the basics of making a page and putting content on it out of the way I need to figure out how to host it. Github Pages and Github Actions seem like they would probably be easy enough to setup. I do currently use my github pages for another project though. I do have access to a CDN from another project which I could use to host the files. First step: Upload this to github and setup an action to build the website. After that I can figure out how to get it in to the CDN.
Github Actions #
I found github actions for everything I need to do and I divided it in to two separate steps build and deploy. The build step downloads the repo, downloads hugo and then builds the site and shoves it in the /public folder. This took a bit longer than I was hoping because the actions kept failing. Eventually I figured out I needed to increase the timeout in the hugo config. It takes roughly three minutes to build but the max time is 30 seconds by default. This might just be the theme or the image optimization but I can figure this out later, for now it builds.