"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.
This commit is contained in:
Emil Gulamov 2024-02-24 05:48:44 +04:00
parent 899cdd6cad
commit f81a5542dd

View file

@ -25,6 +25,7 @@ const blogPosts: CollectionEntry<"blog">[] = await getCollection("blog");
// Filter out the current post to get related posts // 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. // 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. // 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( const relatedPosts: CollectionEntry<"blog">[] = blogPosts.filter(
(blogEntry) => blogEntry.slug !== post.slug, (blogEntry) => blogEntry.slug !== post.slug,
); );