RELATED
this page = Page(/playing-a-cd-on-a-computer.mmark)
RegularPages = Pages(253)
Related = Pages(0)
END RELATED
According to the docs there is nothing mandatory to configure. (But I tried pasting the default config into the config.toml file anyway, and setting the threshold to 2 (out of 100) to try and match more pages.)
I am using Hugo 0.46.
What am I doing wrong? Or how can I go about debugging this for myself? I’ve sat in front of this for half an hour now, trying all different combinations I can think of but it doesn’t change anything.
in the front-matter of all blog posts, it finds related posts.
Perhaps the doc could be updated to describe what keywords means? I don’t see how it’s distinct from the categories (or other taxonomies) or the sections.
Is it something that is required only for the related feature or does it have some other effect as well?
You are right about the documentation part. We wil fix that.
The default config builds indexes from date and keywords because these are reserved front matter fields in Hugo, so many people will have values in these. Many themes use the keywords list to create the keywords meta tag, and it felt natural to use that as a “default related” index.
But as you have noted, no default config fits everyone.
Keywrods, and date, as mentioned by @bep, but also ‘tags’. You also have to configure this in hugo.
/*
Config is the top level configuration element used to configure how to retrieve
related content in Hugo.
An example site config.toml:
[related]
threshold = 1
[[related.indices]]
name = "keywords"
weight = 200
[[related.indices]]
name = "tags"
weight = 100
[[related.indices]]
name = "date"
weight = 1
pattern = "2006"
Regis’ post is awesome. Hadn’t seen it until reading the docs recently, where it’s linked.
It’s not clear in this thread if the OP was addressed though. Can they set category as index from config as seems to be indicated by @Hash_Borgir?
If not, and since you’ve already got the taxonomy, you can modify the following code (using the old method) which creates a see also list with a cap on the max number of results:
It won’t be as performant as the built-in but it won’t require you to add more taxonomy and at 270 odd posts you’re not going to notice much if any perceptible difference in speed.