diff options
Diffstat (limited to 'src/components/Citations.astro')
-rw-r--r-- | src/components/Citations.astro | 39 |
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> |