Skip to content

Commit

Permalink
Fix Get collection Calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Gawaksh authored and Gawaksh committed Jan 28, 2025
1 parent b0cac24 commit bcfab1a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pages/articles/tag/[...tag].astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import MainLayout from "../../../layouts/MainLayout.astro";
import ArticleCard from "../../../components/ui/ArticleCard.astro";
import { getCollection } from 'astro:content';
import type { CollectionEntry } from "astro:content";
import { capitalize } from "../../../utils";
export async function getStaticPaths() {
const posts = await getCollection('posts');
const posts = await getCollection('blog'); // Ensure 'blog' matches your collection name
const tags = new Set(posts.flatMap(post => post.data.tags));
return Array.from(tags).map(tag => ({
Expand All @@ -20,12 +19,12 @@ if(tag === undefined) {
throw new Error('Tag is required');
}
const posts = await getCollection('posts');
const posts = await getCollection('blog'); // Ensure 'blog' matches your collection name
const tagArticles = posts.filter(post => post.data.tags.includes(tag));
---

<MainLayout title="Search Results">
<main class="space-y-20">
<main class="space-y-20">
<div class="py-8 px-4 mx-auto max-w-screen-xl lg:py-16 lg:px-3">

<a href="/articles" class="inline-flex items-center font-medium text-black hover:text-green my-4">
Expand All @@ -43,5 +42,5 @@ const tagArticles = posts.filter(post => post.data.tags.includes(tag));
))}
</div>
</div>
</main>
</main>
</MainLayout>

0 comments on commit bcfab1a

Please sign in to comment.