feat: PostGrid aplikatzen du posta eta etiketetan
This commit is contained in:
1 parent
43a8df169b
commit
8ac7674e7a
6 files changed
+74
-93
No files matched your search
+24
-10
@@ -3,11 +3,13 @@ import { getCollection } from "astro:content";
|
||||
import BaseHead from "../../components/BaseHead.astro";
|
||||
import Header from "../../components/Header.astro";
|
||||
import Footer from "../../components/Footer.astro";
|
||||
import Post from "../../components/Post.astro";
|
||||
import ColorScript from "../../components/ColorScript.astro";
|
||||
|
||||
import { SITE_TITLE, SITE_DESCRIPTION } from "../../config";
|
||||
import Container from "../../components/Container.astro";
|
||||
import PostGrid from "../../components/PostGrid.astro";
|
||||
import getTags from "../../scripts/getTags";
|
||||
import Tags from "../../components/Tags.astro";
|
||||
|
||||
let posts = await getCollection("posts");
|
||||
|
||||
@@ -16,6 +18,8 @@ posts = posts.sort(
|
||||
new Date(b.data.updated || b.data.added).valueOf() -
|
||||
new Date(a.data.updated || a.data.added).valueOf(),
|
||||
);
|
||||
|
||||
const tags = getTags(posts);
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
@@ -24,15 +28,25 @@ posts = posts.sort(
|
||||
<body>
|
||||
<Container>
|
||||
<Header />
|
||||
<main>
|
||||
<content>
|
||||
<ul class="posts-list">
|
||||
{posts.map((post) => <Post post={post} />)}
|
||||
</ul>
|
||||
</content>
|
||||
</main>
|
||||
</Container>
|
||||
<main>
|
||||
<content>
|
||||
<Tags tags={tags} />
|
||||
<PostGrid posts={posts} />
|
||||
</content>
|
||||
</main>
|
||||
<Container>
|
||||
<Footer />
|
||||
<ColorScript /></Container
|
||||
>
|
||||
</Container>
|
||||
<ColorScript />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<style>
|
||||
content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2em;
|
||||
}
|
||||
</style>
|
||||
+17
-11
@@ -3,11 +3,11 @@ import { getCollection, type CollectionEntry } from "astro:content";
|
||||
import BaseHead from "../../components/BaseHead.astro";
|
||||
import Header from "../../components/Header.astro";
|
||||
import Footer from "../../components/Footer.astro";
|
||||
import Post from "../../components/Post.astro";
|
||||
import ColorScript from "../../components/ColorScript.astro";
|
||||
|
||||
import { SITE_TITLE, SITE_DESCRIPTION } from "../../config";
|
||||
import Container from "../../components/Container.astro";
|
||||
import PostGrid from "../../components/PostGrid.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection("posts");
|
||||
@@ -49,16 +49,22 @@ let sortedPosts = tag.sort(
|
||||
<body>
|
||||
<Container>
|
||||
<Header />
|
||||
<main>
|
||||
<content>
|
||||
<h3>"{currentTag}" etiketa daukaten postak</h3>
|
||||
<ul class="tags-list">
|
||||
{sortedPosts.map((post) => <Post post={post} />)}
|
||||
</ul>
|
||||
</content>
|
||||
<Footer />
|
||||
</main>
|
||||
<ColorScript />
|
||||
</Container>
|
||||
<main>
|
||||
<content>
|
||||
<h3>"{currentTag}" etiketa daukaten postak</h3>
|
||||
<PostGrid posts={sortedPosts} />
|
||||
</content>
|
||||
</main>
|
||||
<Container>
|
||||
<Footer />
|
||||
</Container>
|
||||
<ColorScript />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<style>
|
||||
h3 {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user