I started to look into the templates for the Hello Friend theme.
If adding stuff to the
<head> I’m wondering if there is a typo in the
Should this read
If you want to include any custom html just before </head>, put it in /layouts/partials/microblog_head.html?
The theme was created before the inclusion of microblog_head.html. The microblog_head.html includes things specific to micro.blog such as custom css and plugs.
I would suspect that first line still applies if you want to add something. Or, you can add things via the Meta plugin
These comments were in the file
The second line states
Do not put anything in this file - it’s only here so that hugo won’t throw an error if /layouts/partials/extended_head.html doesn’t exist.
“this file” is
The plugin would probably do the trick, thanks, but It’s just a little confusing.
It can be very confusing to understand. The extend_head.html is called from the head.html and you will get and error if a file is called and isn’t there.
We can only speculate, but the original author probably wrote that comment as a note to themselves. “Hey, future self, in case you forget what this file is about, it’s just a placeholder that’s intended for theme users to override.”
The idea is that instead of editing that file, the user creates a custom theme and includes their own file, overriding the original one. But technically, nothing is stopping you from editing the original.
Depending on how a developer designs and structures their theme, there might be more than one way to add stuff to the
head. In this specific case, the templates
baseof.html, and even
microblog_head.html are potential locations for adding additional
head code. The original theme developer intended for you to put stuff in
extended_head.html but in the end, it’s up to you.
As @mandaris already pointed out, the Micro.blog way to just add something to the
head is via the plug-in.
I understand Hugo and templates a tiny bit. My only confusion is what I think is a typo or a cut and paste error for the path to the file.
In the first line of the comment they say to add your extra stuff to
The second line of the comment starts out
Do not put anything in this file
which is … extended_head.html as you can see from the screenshot.
I thought the comment instructions might have been from the micro.blog version of the theme and if there was a preferred way to add the stuff.
@sod clarified that it was probably from the original theme author and the preferred way is by plugin, which is cool. I just like to dig around. I was hand coding HTML and CSS 20 years ago … for fun.