summaryrefslogtreecommitdiff
path: root/src/components/Citations.astro
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-24 12:08:41 -0300
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-24 12:50:43 -0300
commitf9a77c5c27aede4e5978eb55d9b7af781b680a1d (patch)
treed545e325ba1ae756fc2eac66fac1001b6753c40d /src/components/Citations.astro
feat!: initial commit
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.astro39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/components/Citations.astro b/src/components/Citations.astro
new file mode 100644
index 0000000..cc82eda
--- /dev/null
+++ b/src/components/Citations.astro
@@ -0,0 +1,39 @@
+---
+import type { CollectionEntry } from "astro:content";
+import { getEntries } from "astro:content";
+
+type Props = { citations: CollectionEntry<"blog">["data"]["relatedPosts"] };
+const citations = await getEntries(Astro.props.citations ?? []);
+---
+{
+ citations.length > 0 &&
+ (
+ <aside>
+ <p>O autor recomenda ler também:</p>
+ <ul>
+ {
+ citations.map(({ collection, id, data }) => (
+ <li
+ itemprop="citation"
+ itemscope
+ itemtype="http://schema.org/BlogPosting"
+ itemid={Astro.url.href.replace(/[^\/]*\/?$/, id)}
+ >
+ <a href={`/${collection}/read/${id}`}>
+ <cite itemprop="headline">{data.title}</cite>
+ </a>
+ </li>
+ ))
+ }
+ </ul>
+ </aside>
+ )
+}
+
+<style>
+ @media print {
+ aside {
+ display: none;
+ }
+ }
+</style>