The "related articles" section at the bottom of a blog post is exactly the kind of thing you hardcode at first — two links picked by hand — and then forget to maintain. The result: stale suggestions pointing to unrelated articles, or worse, articles that no longer exist.
On this blog, all content is described in a single posts.json file, with each article's slug, category, and tags. That's enough to automatically calculate relevant suggestions without a database.
The problem with hardcoded links
The initial version passed an array of links to blog_footer() :
<?php blog_footer ([ [ 'url' => '/blog/commentaires-sans-bdd-php' , 'title' => 'Adding comments...' ], [ 'url' => '/blog/creer-un-blog-avec-claude-code' , 'title' => 'Building a blog...' ], ]); ?>
Enter fullscreen mode
Exit fullscreen mode
Functional, but requires manual maintenance in every article file.…