about
projects
blog

This Site!

My portfolio site was an experiment with using HTMX and Go/Gin Framework. I have created and destroyed many portfolios over the past 2 years, so I decided to keep this one pretty simple. Turns out that using HTMX is as easy as putting the CDN link at the top of the html file! It took me a bit of time to figure out, but I ended up using the htmx features mainly with the nav links that the top. When the user clicks the "about" link for example, the main content is replaced by the html returned by the server endpoint. So, this ended up being a combination of hx attributes to get what feels like a single page application (SPA) feel.


One problem that a ran into was that I noticed that when I would refresh any of the pages, only the partial html delivered via the AJAX call was being rendered. To get around this issue, I created two version of the page that would conditionally render the page based on if the request came with the "HX-Request" header or not. I also got used to using templates again with Go, which are not to dissimilar to Handlebars with Node.


On the Go side of things, it was mostly straight forward. I will say that making the database connection requires a bit more setup and boilerplate than the same process might take with JavaScript, but I feel like it gave me a bit more insight into all of the processes that happen in order to read from the database, structure the data, then return it in a usable format to the frontend. I will definitely be using this stack in future projects!