Blog
Working on the Blog
General gripes
I don't really have anything to say here, but I wanted to get some idea of what it would be like to actually write a new post from this environment. Previously, I was doing a pretty nice thing where I could just make my little notes in a markdown file. And then I considered using Emacs for org mode. I have a friend who is a real Emacs guy, and I think his setup is beautiful. But I have a hard time getting going with it, particularly for work. Without using it some during the actual work day, I'm not sure I can get used to it enough. I have some vim experience, well neovim, and while I'm not very good at using it either, it does get enough that I feel I can work my way to using it more often. I'm something of a VSCode user, even though I have a general distrust for Microsoft. I'm not quite as crazy as some, and I used to be a pretty big Microsoft fan. Unfortunately, they keep proving their critics right lol. Would love to get as far off their platform as I can reasonably do. At work it's difficult because there's some internal Amazon stuff and they do a reasonable job of supporting VSCode and JetBrains tools, but everything else is kinda DIY. I know how I would go about getting neovim working there, but it just feels like a lot of work, when I'm supposed to be doing something, you know? Anyway, this is my little stream of consciousness typing, I think this works reasonably, but I don't know exactly what it's going to look like. Also I want to know what things like code are going to look like.
Lol, formatters
So, I probably need some way to put little code snippets in these things. I mean it would be weird to not have any mechanism for that at all, but, my first little attempt did not go so great lol. Mostly, my formatter runs on save and absolutely nukes any formatting that the code used to have.
Ok, after disabling the formatter, and stealing some styling from a stack overflow question, I've managed to get some limited ability to render code in here. I know that a real site would just use some JS to do this a much prettier way, but i think this is gonna need to be good enough for me. Go has some cool init stuff that you can do, I recently used it for work, but here I'm just literally loading all the HTML from these little blog posts when the server starts up. From there, it just renders them by their id in this map. This is like a pretty terrible idea, but it gives me an easy implementation for the "Blog" page and for the pages that have the individual posts. So that's just gonna need to be good enough (for now).
func init() {
// we're just pulling in all the raw html blog posts.
// Proabably a bad idea to just load these at the top, but I'm going to ignore that for now
for postId, post := range posts {
postString, err := os.ReadFile(path.Join("posts", post.filename))
if err != nil {
log.Fatalf("Hey I failed to read the posts, %s", post.filename)
}
postLookup[postId] = template.HTML(postString)
postList = append(postList, PostListItem{
postId,
post.Title,
post.Intro,
})
slices.SortFunc(postList, func(a, b PostListItem) int {
if a.Id < b.Id {
return 1
} else if a.Id == b.Id {
return 0
} else {
return -1
}
})
}
}
Honestly, this framework seems fine to me. It may literally be time to just deploy this somewhere and iterate from wherever it's deployed.