Blog Of Rishi Panthee

Using Hugo To Launch My Blog

Test post on how I used hugo to launch this blog.

Installing Hugo:

Since I’m on a mac, I used homebrew to do so.

brew install hugo

After brew does the update that takes forever, it was time to setup the blog.

cd theRightDirectory
hugo new site blog
git init
git submodule add themes/bearblog
echo "theme = 'bearblog'" >> config.toml
hugo server

And after that, the base of the blog was working. I navigated to the site and I saw it appear for the first time.

Look ma, I made a blog

From there on it, was pretty simple. I used

hugo new blog/

to create my first blog post, but quickly changed it to be a directory so I could store the images there easily. And after that, it was done. I just had to write up this content that will probably have 1-2 readers.

Now came depolyment. I use caddy as my webserver, and I wanted this to be accessible on I already had stuff running on and so I needed to either build it and use caddy path matching, or figure out a way to buddy up the 2 stuff somehow. I decided to go with option 1 and use caddy path matching.



I was able to get the built files to the public folder. I moved those over onto my server and then modify the caddy config to route anything from /blog to the generated files.

My old caddy config looked like the following: {
  @static {
    path *.ico *.css *.js *.gif *.webp *.avif *.jpg *.jpeg *.png *.svg *.woff *.woff2
  header @static Cache-Control max-age=86400
  root * /usr/share/caddy/rishipantheecom
  file_server browse

I simply added the follwoing

handle_path /blog* {
  root * /usr/share/caddy/rishipantheeblog
  file_server browse

And that was about it. From there on, the blog is working just fine.

#hugo #blog