The Blog

Related posts that actually relate

Headless CMSTechnical SEO

Most blog "related posts" sections show the three most recent articles regardless of topic. We replaced ours with posts from the same topic cluster, so a reader on a headless CMS post sees more headless CMS content, not whatever we published last.

The problem

Latest posts" is not "related posts"

Most blog platforms show related posts as the three or six most recent articles. WordPress does it. Most headless CMS templates do it. It's the default because it's the easiest query to write: sort by date, take the first few, done.

The problem is that "latest" and "related" are different things. A reader on a post about structured data doesn't care that you also published something about scope creep last week. They want more structured data content, or more technical SEO content, or more content about the same CMS platform.

Date-sorted related posts are a missed internal linking opportunity. They don't help readers find depth on a topic. They don't signal to search engines that your content is connected. They're filler.

The fix

Match by topic, fall back to category, then date

Our blog posts in Payload have a category field and pillar page references. A post about cache invalidation is categorised under Headless CMS and Web Performance and linked to the /headless-cms and /web-performance pillar pages.

The related posts query uses these fields instead of date. When a reader finishes a post categorised under "Headless CMS," the related posts section shows other posts with the same category. Not whatever we published most recently, posts on the same topic.

The logic is straightforward:

  1. Find posts that share at least one category with the current post
  2. Exclude the current post
  3. Sort by publish date within that filtered set
  4. If fewer than the target count match, fall back to the most recent posts from any category

The fallback matters. A post on a niche topic might be the only one in its category. Showing an empty related section is worse than showing recent posts. The fallback ensures something always appears, but it's the last resort, not the default.

Internal linking

Topic clusters need connected content

Search engines understand your site's structure through internal links. A cluster of posts about headless CMS that all link to each other, and to a pillar page, signals that your site has depth on that topic. A cluster of posts that link to whatever was published most recently signals nothing.

Topic-matched related posts create these internal links automatically. Every new post in a category strengthens the cluster. The links are contextually relevant, a reader clicking from one headless CMS post to another is a signal that both posts serve the same intent.

This isn't a theory. The related posts section at the bottom of every post on our blog links to posts in the same topic cluster. On the /headless-cms pillar page, the "You might also like" section shows posts tagged with that pillar. The internal linking structure builds itself as we publish.

Implementation

A query, not a plugin

In a traditional CMS, you'd install a related posts plugin that analyses content similarity or tags. In Payload, it's a query.

The post's category field is a relationship to a categories collection. The related posts query filters the posts collection by that relationship, excludes the current post's ID, sorts by date, and limits to six results.

There's no machine learning, no content analysis, no third-party service. The relationships are explicit, editors assign categories when they create a post, and the related posts follow from that assignment.

This means the quality of the related posts depends on the quality of the categorisation. If editors tag everything as "General," the related posts are no better than date-sorted. The content architecture has to be right for the related posts to be right.

We keep our category list short and specific. Every post gets at least one category. The categories map to pillar pages. The related posts, the pillar page content, and the internal links all come from the same structure.

Pillar pages

Related posts and pillar pages share the same data

Our pillar pages /headless-cms, /web-performance, /services/digital-platforms, each have a "You might also like" section at the bottom that pulls posts linked to that pillar. This is the same mechanism as the blog's related posts: a query filtered by relationship, not by date.

When we publish a new post and assign it to the Headless CMS category with a pillar page reference to /headless-cms, three things happen automatically. The post appears in the blog listing. The related posts on other Headless CMS posts include the new one. And the /headless-cms pillar page's content section includes it.

One editorial action, assigning the category and pillar page, creates three internal links. No manual updates to the pillar page. No separate "featured posts" list to maintain. The content architecture does the work.

Topic-matched related posts create internal links automatically. Every new post in a category strengthens the cluster.

FAQs

Common questions about related posts and topic clusters

Only if you're not publishing in that category. The related posts are sorted by date within the category, so new posts appear at the top. If a category goes months without a new post, the related section will show older content, which is still more relevant than unrelated recent posts.

The query matches posts that share at least one category. A post categorised under both "Headless CMS" and "Technical SEO" will show related posts from both categories, prioritised by date.

The query runs at build time or server-render time. It's a single database query with a category filter, faster than a content-similarity algorithm and no different in cost from a date-sorted query.

Fewer than you think. We use a handful that map directly to pillar pages. Too many categories dilutes the clusters, every post ends up in its own category and the related posts are back to being random.

Little Dash

Is your blog's internal linking working for you?

We build content architectures in Payload that create internal links automatically, related posts, pillar pages, and topic clusters that strengthen as you publish.