summaryrefslogtreecommitdiff
path: root/src/components/Citations.astro
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-08-05 18:50:37 +0100
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-08-05 18:50:37 +0100
commit0af094770c4ebabc56ff761a8bd215bc397c0f7e (patch)
treea9ad669c8b84b4d13897732ed93ccfcbbeb2cb25 /src/components/Citations.astro
parent84eef3f848c4efa18985a776021a58720744523a (diff)
refactor: reading page review
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/components/Citations.astro')
-rw-r--r--src/components/Citations.astro15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/components/Citations.astro b/src/components/Citations.astro
index ff42ad4..7ae6b26 100644
--- a/src/components/Citations.astro
+++ b/src/components/Citations.astro
@@ -1,9 +1,8 @@
---
-import type { CollectionEntry } from "astro:content";
-import { getEntries } from "astro:content";
+import type { BlogPosting } from "@lib/collection/types";
-type Props = { citations: CollectionEntry<"blog">["data"]["relatedPosts"] };
-const citations = await getEntries(Astro.props.citations ?? []);
+type Props = { citations: BlogPosting[] };
+const { citations } = Astro.props;
---
{
citations.length > 0 &&
@@ -12,15 +11,15 @@ const citations = await getEntries(Astro.props.citations ?? []);
<p>O autor recomenda ler também:</p>
<ul>
{
- citations.map(({ collection, id, data }) => (
+ citations.map(({ "@id": id, headline }) => (
<li
itemprop="citation"
itemscope
itemtype="http://schema.org/BlogPosting"
- itemid={Astro.url.href.replace(/[^\/]*\/?$/, id)}
+ itemid={id}
>
- <a href={`/${collection}/read/${id}`}>
- <cite itemprop="headline">{data.title}</cite>
+ <a href={`/blog/read/${id}`}>
+ <cite itemprop="headline">{headline}</cite>
</a>
</li>
))