"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:
parent
899cdd6cad
commit
f81a5542dd
1 changed files with 1 additions and 0 deletions
|
@ -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,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue