It’s taken me hours, but I’ve found a way to solve a needwant regarding my blog design. Due to the way Micro.blog creates the Archive and Photos pages, there are no Hugo template variables available to distinguish them from the “home” page, and I’ve been wanting to hide the avatar/title header from those pages. After much googling and hair-pulling, I’ve been able to do what I want using JavaScript to create custom id
selectors on the body
tags of just those pages, and then use that selector to hide that header via CSS. (This will fail, of course, for people browsing without JavaScript turned on, but it sucks to be them, I guess?) As such, I’ll shortly be switching the blog over to the new theme code. It’s the same design as what I’ve been using for the past week or so, but the code is cleaned up and less cluttered, and thanks to this JavaScript trick, I no longer need to do a bunch of extra templating to make my own Archive or Photos pages.
Addenda
- I flipped the script a bit, so to speak, and hid the profile header by default in the CSS and use JavaScript to unhide it on the home page. It’s still showing briefly on the Archive page, presumably because the page is so large, and that’s annoying and bit mysterious, but I don’t know what else to do.