diff --git a/src/components/ui/avatars/AvatarBlog.astro b/src/components/ui/avatars/AvatarBlog.astro new file mode 100644 index 0000000..9e20c2f --- /dev/null +++ b/src/components/ui/avatars/AvatarBlog.astro @@ -0,0 +1,20 @@ +--- +import { Image } from "astro:assets"; + +import type { CollectionEntry } from "astro:content"; + +const { blogEntry } = Astro.props; + +interface Props { + blogEntry: CollectionEntry<"blog">; +} +--- +
+ {blogEntry.data.authorImageAlt} +
diff --git a/src/components/ui/avatars/AvatarBlogLarge.astro b/src/components/ui/avatars/AvatarBlogLarge.astro new file mode 100644 index 0000000..4f13485 --- /dev/null +++ b/src/components/ui/avatars/AvatarBlogLarge.astro @@ -0,0 +1,16 @@ +--- +import { Image } from "astro:assets"; + +import type { CollectionEntry } from "astro:content"; + +const { blogEntry } = Astro.props; + +interface Props { + blogEntry: CollectionEntry<"blog">; +} +--- +
+ {blogEntry.data.authorImageAlt} +
\ No newline at end of file diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro new file mode 100644 index 0000000..cb5ea3c --- /dev/null +++ b/src/pages/blog/[...slug].astro @@ -0,0 +1,96 @@ +--- +// Import section components +import MainLayout from "../../layouts/MainLayout.astro"; +import ProductTabBtn from "../../components/ui/buttons/ProductTabBtn.astro"; +import PrimaryCTA from "../../components/ui/buttons/PrimaryCTA.astro"; +import AvatarBlogLarge from "../../components/ui/avatars/AvatarBlogLarge.astro"; +import { Image } from "astro:assets"; +import { capitalize, formatDate } from "../../utils"; +import { getCollection } from "astro:content"; + +export async function getStaticPaths() { + const blogPosts = await getCollection("blog"); + return blogPosts.map((post) => ({ + params: { slug: post.slug }, + props: { post }, + })); +} + +const { post } = Astro.props; +--- + + +
+
+
+
+ +
+
+
+
+ + + {post.data.author} + + +
+
    +
  • + {formatDate(post.data.pubDate)} +
  • +
  • + {post.data.readTime} min read +
  • +
+
+
+
+
+
+ +

+ {post.data.title} +

+ +
+ { + post.data.contents.map((content: string, index: any) => ( + index === 1 ? +

+ {content} +

+ {post.data.cardImageAlt} :

+ {content} +

+ )) + } +
+ +
+ { + post.data.tags.map((tag: string) => ( + + {capitalize(tag)} + + )) + } +
+
+
+