If I try to show related posts based on description
(a custom .Params
front matter variable), I neither get a list of related posts, even with a threshold
value of 1.
# Related content settings
[related]
treshold = 1
includeNewer = true
toLower = false
[[related.indices]]
name = "description"
weight = 100
Unfortunately if I try to build a related index on ‘description’, but with pages from the same section, I also get an empty page collection.
{{ $related2 := where (.Site.RegularPages.RelatedIndices . "description") "CurrentSection.Title" .CurrentSection.Title }}
Edit
After a bit more research it turns out that related content works much different than I expected.
If I use the following descriptions for all content files, it works:
This is an example description.
This is an example description.
This is an example description.
This is an example description.
This is an example description.
With this, each page gets 4 related posts.
But if the description is even off with one word, it doesn’t work. For instance, as far as Hugo is concerned, a page with a description
front matter variable of
This is some description.
Does not relate to
This is an example description.
It gets worse with longer descriptions. The description
front matter variable values below all show up in the related posts:
This is a brief description of an article about Hugo's related content feature, which I'm learning about today.
This is a brief description of an article about Hugo's related content feature, which I'm learning about today.
This is a brief description of an article about Hugo's related content feature, which I'm learning about today.
This is a brief description of an article about Hugo's related content feature, which I'm learning about today.
This is a brief description of an article about Hugo's related content feature, which I'm learning about today.
So if I give my 5 posts the exact same description, they show up as related.
But if I change the description
value of …
This is a brief description of an article about Hugo’s related content feature, which I’m learning about today.
to …
This is a short description of an article about Hugo’s related content feature, which I’m learning about tomorrow.
(changed words in bold)
…then Hugo does not consider this a related page anymore. And that’s with a threshold
value of 1, even though the sentences are 89% identical (only 2 out of 18 words changed).
Perhaps I use the wrong settings? These are my configuration options:
[related]
treshold = 1
includeNewer = true
toLower = false
[[related.indices]]
name = "description"
weight = 100