Related content across top-level folders

It appears this topic has been raised before but the only answer was a denial that it happens, yet I’ve eliminated other possibilities.

As background, I have several active Hugo sites that make use of related content but have just noticed an issue with this one. The site in question is a sort of cooking / travel site where the content is in two main top-level folders, one for “articles” which are mostly about the ingredients we cook with. The other folder is recipes.

I’ve created a taxonomy called “ingredients” with articles labeled with the ingredient it’s about and recipes tagged with the main ingredient. The idea was that articles would be shown as related content to recipes but this isn’t happening. I’ve tried many things to fix this but it’s clear that no matter what weigh you give to related.indecies, you will only get related content that is in the same top-level folder. Is there any way to get around this?

Please post the relevant portion of your site config.

Here’s the configuration for related content:

  tag = "tags"
  ingredient = "ingredients"
  course = "courses"
  cuisine = "cuisine"
  category = "categories"

  threshold = 0
  includeNewer = false
  toLower = false
    name = "ingredients"
    weight = 100
    name = "categories"
    weight = 100
    name = "courses"
    weight = 90
    name = "tags"
    weight = 80

Any chance that the stuff not showing is newer than the page you’re viewing?

No, the pages all have the same date, and I did try to change dates just in case.

I am unable to reproduce the problem.

git clone --single-branch -b hugo-forum-topic-46031 hugo-forum-topic-46031
cd hugo-forum-topic-46031
hugo server

Please pull changes. I just improved the examples.

Hm, yup, your test works fine. It must be something else to do with my specific situation. One thing that seems to be working is removing the publication date entirely.

If you are setting publishDate or date in front matter to a future date, the content is not published.

That’s correct, but not applicable in this case. The dates were all back in 2017. It might be an edge case when all publish dates are the same, so neither older nor newer for the purposes of related content?

I retested with the example I posted earlier. All front matter dates are identical to this:

date = 2023-09-03
publishDate = 2017-09-03

No problems.

It doesn’t matter whether includeNewer is true or false.

We’d need to look at your repository to see what’s happening.