-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
66 additions
and
66 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
import PostList from "../../components/PostList.astro"; | ||
import Layout from "../../layouts/Page.astro"; | ||
import { type CollectionEntry, getCollection } from "astro:content"; | ||
export async function getStaticPaths() { | ||
const categories = await getCollection("categorie"); | ||
return categories | ||
.filter((categorie) => (categorie.slug as string) !== "uncategorized") | ||
.map((categorie) => ({ | ||
params: { slug: categorie.slug }, | ||
props: categorie, | ||
})); | ||
} | ||
type Props = CollectionEntry<"categorie">; | ||
const categorie = Astro.props; | ||
const { Content } = await categorie.render(); | ||
const posts = await getCollection("blog"); | ||
const categoriePosts = posts | ||
.filter((post) => post.data.draft === false) | ||
.filter((post) => post.data.categories.includes(categorie.slug)) | ||
.sort((a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()); | ||
const title = categorie.data.title; | ||
const description = `Todas las entradas sobre ${title}`; | ||
--- | ||
|
||
<Layout title={title} description={description}> | ||
<section> | ||
<h1>{categorie.data.title}</h1> | ||
<Content /> | ||
{categoriePosts.length === 0 && <p>Aún no hay entradas.</p>} | ||
{ | ||
categoriePosts.length > 0 && ( | ||
<> | ||
<h2>Entradas sobre {categorie.data.title.toLowerCase()}</h2> | ||
<PostList posts={categoriePosts} /> | ||
</> | ||
) | ||
} | ||
</section> | ||
</Layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
import Layout from "../../layouts/Page.astro"; | ||
import CategorieList from "../../components/CategorieList.astro"; | ||
--- | ||
|
||
<Layout | ||
title="Categorías" | ||
description="Una visión general de todos las categorías en este blog." | ||
> | ||
<h1>Todos las categorías de este blog</h1> | ||
<CategorieList categories="all" /> | ||
</Layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.