diff --git a/src/components/AuthorCard.astro b/src/components/AuthorCard.astro index 8a12b3c..e5eb8c7 100644 --- a/src/components/AuthorCard.astro +++ b/src/components/AuthorCard.astro @@ -12,7 +12,7 @@ const { name, avatar, bio } = author.data ---
{`Avatar

{name}

diff --git a/src/components/BlogCard.astro b/src/components/BlogCard.astro index 6c71699..33fe3a7 100644 --- a/src/components/BlogCard.astro +++ b/src/components/BlogCard.astro @@ -5,6 +5,7 @@ import { Image } from 'astro:assets' import { Badge } from '@/components/ui/badge' import { Separator } from '@/components/ui/separator' import Link from './Link.astro' +import { getEntry } from 'astro:content' type Props = { entry: CollectionEntry<'blog'> @@ -16,10 +17,26 @@ const { entry } = Astro.props as { const formattedDate = formatDate(entry.data.date) const readTime = readingTime(entry.body) + +let author = null +if ( + entry.data.author && + typeof entry.data.author === 'object' && + 'collection' in entry.data.author +) { + author = await getEntry(entry.data.author) +} else if (typeof entry.data.author === 'string') { + author = { + data: { + name: entry.data.author, + avatar: '/favicons/android-chrome-512x512.png', + }, + } +} ---
) @@ -48,6 +65,21 @@ const readTime = readingTime(entry.body)
+ {author && ( + <> +
+ {author.data.name} + {author.data.name} +
+ + + )} {formattedDate} {readTime} diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro deleted file mode 100644 index 595fe22..0000000 --- a/src/components/FormattedDate.astro +++ /dev/null @@ -1,17 +0,0 @@ ---- -interface Props { - date: Date -} - -const { date } = Astro.props ---- - - diff --git a/src/components/SocialIcon.astro b/src/components/SocialIcon.astro deleted file mode 100644 index cc2b334..0000000 --- a/src/components/SocialIcon.astro +++ /dev/null @@ -1,15 +0,0 @@ ---- -import 'bootstrap-icons/font/bootstrap-icons.css' - -export interface Props { - URL: string - icon: string - icon_size: string -} - -const { URL, icon, icon_size } = Astro.props ---- - - - - diff --git a/src/components/TableOfContents.astro b/src/components/TableOfContents.astro index da3b9b0..9e258b2 100644 --- a/src/components/TableOfContents.astro +++ b/src/components/TableOfContents.astro @@ -27,7 +27,7 @@ function buildToc(headings: Heading[]) { } --- -
+
Table of Contents diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx new file mode 100644 index 0000000..77e9fb7 --- /dev/null +++ b/src/components/ui/card.tsx @@ -0,0 +1,76 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +const Card = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +Card.displayName = "Card" + +const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardHeader.displayName = "CardHeader" + +const CardTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardTitle.displayName = "CardTitle" + +const CardDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardDescription.displayName = "CardDescription" + +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)) +CardContent.displayName = "CardContent" + +const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +CardFooter.displayName = "CardFooter" + +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 98e4778..5cb3f7a 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -2,8 +2,7 @@ import { type CollectionEntry, getCollection, getEntry } from 'astro:content' import Layout from '@layouts/Layout.astro' import Container from '@components/Container.astro' -import FormattedDate from '@components/FormattedDate.astro' -import { readingTime } from '@lib/utils' +import { formatDate, readingTime } from '@lib/utils' import PostNavigation from '@components/PostNavigation.astro' import TableOfContents from '@components/TableOfContents.astro' import { Image } from 'astro:assets' @@ -104,7 +103,7 @@ if ( alt={post.data.title} width={1200} height={630} - class="mb-8 rounded-lg object-cover shadow-lg" + class="mb-8 rounded-xl object-cover shadow-lg" /> ) } @@ -144,7 +143,7 @@ if ( ) } - + {formatDate(post.data.date)} {readingTime(post.body)}
diff --git a/src/pages/index.astro b/src/pages/index.astro index 62ad65a..f065b4f 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -6,6 +6,7 @@ import BlogCard from '@components/BlogCard.astro' import { buttonVariants } from '@/components/ui/button' import { getCollection } from 'astro:content' import Link from '@components/Link.astro' +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" const blog = (await getCollection('blog')) .filter((post) => !post.data.draft) @@ -16,8 +17,17 @@ const blog = (await getCollection('blog'))
-
-

Occasionally, less is more

+ + + er·u·dite + /ˈer(y)əˌdīt/ + + +

adjective

+

having or showing great knowledge or learning.

+
+
+

{SITE.TITLE} is an opinionated, no-frills static blogging template built with Astro.