I used Tiny Theme and I had microhooks working fine on my blog, but I suspect a recent update broke those. It seems like microhooks are bypassed for some reason. This doesn’t make sense since each microhook is activated by its own file (if I understand correctly) but from what I can tell none of them work now.
still having this issue. I retried to rebuild the blog and issue persists. This also mean my search in the archive page (plug in from sod) is not working because I copied its code to the microhook page.
Just another update - I’ve been trying exactly the same micohooks on my test blog with Sumo theme, and it seems to work fine so far. I copy-pasted the HTML code from my pain blog to test.
So something is wrong with how the theme is build and creating pages, I’m just not sure what. Meanwhile, Sumo looks clean and works with microhook so I’m toying with the idea of just switching themes…
Nope! I updated a completely unrelated template, though, and I believe that caused the site to rebuild. Pinging @manton in case he has any insight here.
On my test site running the latest Hugo (0.158) I have mixed results.
My Emacs and org-mdoe category page is based on a microhook like on the old blog, layouts/partials/microhook-category-header.html is working fine. As I explained before, this is exactly the same HTML (I copy-pasted) of my regular blog (taonaw.com) where it does not work for whatever reason.
Meanwhile, I tried to use another microhook on the new blog for my archive page, layouts/partials/microhook-archive-lead.html, and it’s being ignored. Again, copy-paste from the regular blog, taonaw.com, where it used to work fine, and now it doesn’t. The new test blog and Sumo theme fail to pick it up. I attempted to rebuild the page and the site.
I’m at a loss. I don’t understand why this happens and what causes it.
I went to look deeper into my theme.
It seems the microhook code was applied to layouts/_default/list.archivehtml.html. Inside this page, there’s this condition:
{{ if templates.Exists "partials/microhook-archive-lead.html" }}
{{ partial "microhook-archive-lead.html" . }}
{{ end }}
So this is what should activate the microhook, as I have it.
however, the page at layouts/list.archivehtml.html does not contain the following condition. I’m not an expert in Hugo, but it looked weird to me that one place has it and one does not. I did a quick search using AI and it seems the hierarchy for Hugo is to use layouts/list.archivehtml.htmlfirst, and the default one is a fallback.
I included the code in the _default file inside list.archivehtml.html, and now I see my archive page as I should.
Based on that it seems that for some reason TinyTheme (and Sumo?) are adding code to the wrong place, a lower priority file that is being bypassed by Hugo by something of higher priority.
I don’t know why that is, when this happened, and if this is correct, but I will keep following this pattern.
Another win. I fixed the issues at taonaw.com/categories/emacs-org-mode/. Over here, the issue was that the title of the page (.title value) was Emacs org-mode. But in the code, I copy-pasted the URL itself, so the condition called for emacs-org-mode. Similar, but not the same.
Meanwhile, on my test blog, I copy pasted the same code, but then I created the page itself, pasting the same name from the URL: emacs-org-mode. So, without meaning too, my test blog had a title value of emacs-org-mode, which on my main blog, the value was Emacs org-mode. Fixed.
This fixed my issue too! Thanks for figuring it out. There had to have been some change to Tiny Theme that changed the hierarchy of which template was prioritized.
Glad to hear it, I hope that was it. I understand why it works, but I’m not sure if it’s some work around for something that was there for a reason. I did contact Matt by the way to ask.