HUGO

Related Links - order diffs when regenerating on otherwise unchanged content

I’m using the related links functionality to add a list of related posts at the end of my blog posts.

I’ve been encountering instances where on successive builds of the site, where none of the related content is actually changing (only minor template changes for instance), Hugo alters the order of links in the related content block. Same content, just different order.

Here’s an example:

If I was adding a new post or changing the contents of the post, I could see why the build might get a new score. But if the change doesn’t impact the content, it seems like the same related link score should be reached, especially because the only factor that I am including in my config is categories.

This is my configuration:

[related]
  threshold = 0
  includeNewer = true
  toLower = false

  [[related.indices]]
    name = "categories"
    weight = 100

Any suggestions on how I could avoid these sort of changes to the related links?

Are you sorting .Site.RegularPages.Related?

  1. Please post the code where you range over the related pages.

  2. Please post the front matter from:
    five-upgrades-homeowners-love-when-remodeling-in-philadelphia

  3. Please post the front matter from:
    four-things-to-learn-from-other-renovations-in-philadelphia

Or even better, please provide a link to the source code repository for your project.