Including Markdown labels in multiple files

I am new to Hugo and I a trying to figure out the right way to have all my markdown posting files share the same label definitions.

That is, I’d like every markdown posting file to automatically include these markdown label definitions:

[Haxe]: "Haxe"
[Lua]: "Lua"

They don’t need to be visibe in the file, they just need to be there somewhere so that they can be called when needed.

Could someone suggest how I can go about doing this?

Not sure what you mean when you refer to labels but it sounds like taxonomies to me

I accidentally left out the example labels. I edited my message to fix that. I’ll look into taxonomies, but my initial understanding is that’s not quite right.

You mean “reference links” right? The only way I can think is to include them in an archetype so they get added to every markdown file you make from it, or, figure out what they turn into in terms of HTML and then add the HTML via your single.html.

Yes, I think reference links is the correct markdown term.

It seems like archetypes will do the trick for now. But ideally I’d like to be able to add more reference links over time, and have all content files able to access these new links.

The Sphinx static site generator has a global variable called rst_prolog that solves this exact problem, so I was hoping there would be something like that in Hugo.

Scratch the idea of putting it in a single.html. It won’t work because it appears the markdown generator is what is merging those.

But I really like this idea, because it makes putting in links so much easier. You just enter [Haxe] or [Lua] in your content, and it “just works”. Easy.

This is wild guessing - what if you do something like this. I wonder…

Create a file that looks like:

[1a2b3cwhatever]: "Dummy"
[Haxe]: "Haxe"
[Lua]: "Lua"
[Hugo]: "Hugo"

Use a script that uses cat to attach your links file to the bottom of your markdown files.

When you update the links file, use a script to loop through your markdown files, find the line with the 1a2b3cwhatever, and return everything above that. Then do a cat again to refresh the bottom of the files.

I assume awk or sed would work. Something like:

awk '{if (match($0,"1a2b3cwhatever")) exit; print}'

It’d need a lot of testing but, it should work.