Range skipping some items in front matter

The code in this tutorial skips some items in the related variable. I have found one issue to be posts in a page bundle (with index.md) but I cannot figure out why it skips a few others. I have 5 posts in the related variable but even trying to add the code in different posts, those posts being skipped are also not appearing in the trial. I have even recreated those (two) specific posts afresh that are not in page bundle and still nothing!

Edit: I tested a few other articles outside a page bundle and some are also skipped. Any ideas? cc @jmooring

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

As a starting point, post your site configuration, but based on your description I think we’ll need to see everything.

I cannot replicate the issue in my dummy content site, hence why I haven’t shared a repo yet. But I think I have diagnosed the issue which I would like your input. Does the related: use file names or slug? I saw the missing content appears if I change the links from slug to the filename. For example, if a file name is hugo.md and the slug is /hugo-md/, changing the slug to filename in the related value makes the article appear. I have several articles where the file name is not the same as the slug. Ditto for a page bundle (bundle name different from slug).

Edit: The filename is indeed the solution here. But how to revert to using the slug instead? I rarely change the slug, but I shorten file names from time to time.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.