From f81a5542dd0c02c1fc5136e506f69d69ec380bf5 Mon Sep 17 00:00:00 2001 From: Emil Gulamov <125820963+mearashadowfax@users.noreply.github.com> Date: Sat, 24 Feb 2024 05:48:44 +0400 Subject: [PATCH] "Add example URL in blog page comments" Included a comment in the '[...slug].astro' file within the src/pages/blog directory. This comment includes a URL providing an example of a more refined approach to choosing related blog posts. --- src/pages/blog/[...slug].astro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index f3f3b6e..f9c80bf 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -25,6 +25,7 @@ const blogPosts: CollectionEntry<"blog">[] = await getCollection("blog"); // Filter out the current post to get related posts // Note: This is a very basic way of choosing related posts, just for the purpose of the example. // In a production site, you might want to implement a more robust algorithm, choosing related posts based on tags, categories, dates, authors, or keywords. +// See example: https://blog.codybrunner.com/2024/adding-related-articles-with-astro-content-collections/ const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter( (blogEntry) => blogEntry.slug !== post.slug, );