diff --git a/frontend/src/components/BlogPostMetadata.astro b/frontend/src/components/BlogPostMetadata.astro deleted file mode 100644 index 99f509b..0000000 --- a/frontend/src/components/BlogPostMetadata.astro +++ /dev/null @@ -1,26 +0,0 @@ ---- -import type { CollectionEntry } from 'astro:content'; -import { getImage } from 'astro:assets'; -import allLinkPreviewImages from '../lib/allLinkPreviewImages'; - -export type Props = CollectionEntry<'blog'>['data']['linkPreview']; - -const { description, image, title } = Astro.props; - -const imageUrl = ( - await getImage({ - src: allLinkPreviewImages[image.path](), - width: 1200, - height: 630, - }) -).src; ---- - - - - - - - - - diff --git a/frontend/src/components/Metadata.astro b/frontend/src/components/Metadata.astro new file mode 100644 index 0000000..0520602 --- /dev/null +++ b/frontend/src/components/Metadata.astro @@ -0,0 +1,33 @@ +--- +import { getImage } from 'astro:assets'; +import allLinkPreviewImages from '../lib/allLinkPreviewImages'; + +export interface Props { + title: string; + description: string; + image?: { + path: string; + altText: string; + }; +} + +const { description, image, title } = Astro.props; + +const imageUrl = image + ? ( + await getImage({ + src: allLinkPreviewImages[image.path](), + width: 1200, + height: 630, + }) + ).src + : null; +--- + +
diff --git a/frontend/src/pages/blog/[slug]/index.astro b/frontend/src/pages/blog/[slug]/index.astro
index 62e85cc..794e027 100644
--- a/frontend/src/pages/blog/[slug]/index.astro
+++ b/frontend/src/pages/blog/[slug]/index.astro
@@ -3,7 +3,7 @@ import BlogPostSubtitle from '../../../components/BlogPostSubtitle.astro';
import ButtonLink from '../../../components/ButtonLink.astro';
import PageTitle from '../../../components/PageTitle.astro';
import Layout from '../../../layouts/Layout.astro';
-import BlogPostMetadata from '../../../components/BlogPostMetadata.astro';
+import Metadata from '../../../components/Metadata.astro';
import { getCollection } from 'astro:content';
import type { CollectionEntry } from 'astro:content';
import blogPostComponents from '../../../components/mdx/blogPostComponents';
@@ -53,15 +53,10 @@ const formattedPublishDate = publishDate.toLocaleDateString('pt', {
});
---
- Uma coleção de artigos que vou escrevendo. Sobretudo por diversão. Uma coleção de artigos que vou escrevendo. Sobretudo por diversão.
Medeiros
Medeiros