From 931bf7277cba0a91b9fc8e62cfccbda3378f92bb Mon Sep 17 00:00:00 2001 From: enscribe Date: Sat, 22 Mar 2025 17:21:30 -0700 Subject: [PATCH] refactor: update site metadata structure --- README.md | 38 ++++++++-------- src/components/AuthorCard.astro | 2 +- src/components/Head.astro | 4 +- src/components/Header.astro | 2 +- src/components/SocialIcons.astro | 60 ++++++++++---------------- src/consts.ts | 74 +++++++++++++++++++------------- src/content.config.ts | 14 +----- src/layouts/Layout.astro | 2 +- src/pages/404.astro | 2 +- src/pages/about.astro | 2 +- src/pages/blog/[...page].astro | 2 +- src/pages/index.astro | 4 +- src/pages/rss.xml.ts | 6 +-- src/styles/global.css | 9 ++-- src/types.ts | 16 +++++++ 15 files changed, 123 insertions(+), 114 deletions(-) create mode 100644 src/types.ts diff --git a/README.md b/README.md index 357f271..a50a922 100644 --- a/README.md +++ b/README.md @@ -94,28 +94,30 @@ This is a list of the various technologies used to build this template: Edit the `src/consts.ts` file to update your site's metadata, navigation links, and social links: -```typescript +```ts export const SITE: Site = { - TITLE: 'astro-erudite', - DESCRIPTION: + title: 'astro-erudite', + description: 'astro-erudite is a opinionated, unstyled blogging template—built with Astro, Tailwind, and shadcn/ui.', - EMAIL: 'jason@enscribe.dev', - NUM_POSTS_ON_HOMEPAGE: 2, - SITEURL: 'https://astro-erudite.vercel.app', + href: 'https://astro-erudite.vercel.app', + featuredPostCount: 2, + postsPerPage: 3, } -export const NAV_LINKS: Link[] = [ - { href: '/blog', label: 'blog' }, - { href: '/authors', label: 'authors' }, - { href: '/about', label: 'about' }, - { href: '/tags', label: 'tags' }, +export const NAV_LINKS: SocialLink[] = [ + { + href: '/blog', + label: 'blog', + }, + // ... ] -export const SOCIAL_LINKS: Link[] = [ - { href: 'https://github.com/jktrn', label: 'GitHub' }, - { href: 'https://twitter.com/enscry', label: 'Twitter' }, - { href: 'jason@enscribe.dev', label: 'Email' }, - { href: '/rss.xml', label: 'RSS' }, +export const SOCIAL_LINKS: SocialLink[] = [ + { + href: 'https://github.com/jktrn', + label: 'GitHub', + }, + // ... ] ``` @@ -185,8 +187,8 @@ The blog post schema is defined as follows: | Field | Type (Zod) | Requirements | Required | | ------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -| `title` | `string` | Must be ≤60 characters. | Yes | -| `description` | `string` | Must be ≤155 characters. | Yes | +| `title` | `string` | Should be ≤60 characters. | Yes | +| `description` | `string` | Should be ≤155 characters. | Yes | | `date` | `coerce.date()` | Must be in `YYYY-MM-DD` format. | Yes | | `image` | `image()` | Should be exactly 1200px × 630px. | Optional | | `tags` | `string[]` | Preferably use kebab-case for these. | Optional | diff --git a/src/components/AuthorCard.astro b/src/components/AuthorCard.astro index aef182e..aeee83a 100644 --- a/src/components/AuthorCard.astro +++ b/src/components/AuthorCard.astro @@ -1,8 +1,8 @@ --- import Link from '@/components/Link.astro' import AvatarComponent from '@/components/ui/avatar' -import type { Link as SocialLink } from '@/consts' import { cn } from '@/lib/utils' +import type { SocialLink } from '@/types' import type { CollectionEntry } from 'astro:content' import SocialIcons from './SocialIcons.astro' diff --git a/src/components/Head.astro b/src/components/Head.astro index f40d1fc..c0c16fa 100644 --- a/src/components/Head.astro +++ b/src/components/Head.astro @@ -30,7 +30,7 @@ const { title, description, image = '/static/twitter-card.png' } = Astro.props {title} - + @@ -44,7 +44,7 @@ const { title, description, image = '/static/twitter-card.png' } = Astro.props - + diff --git a/src/components/Header.astro b/src/components/Header.astro index b21f093..09fa6be 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -19,7 +19,7 @@ import logo from '../../public/static/logo.svg' class="hover:text-primary flex shrink-0 items-center gap-2 text-xl font-medium transition-colors duration-300" > Logo - {SITE.TITLE} + {SITE.title}