diff --git a/src/components/ReplyViaEmail.astro b/src/components/ReplyViaEmail.astro index 9ab399f..98fbca7 100644 --- a/src/components/ReplyViaEmail.astro +++ b/src/components/ReplyViaEmail.astro @@ -1,4 +1,5 @@ --- -const { title } = Astro.props; +import {siteConfig} from "../config"; +const { title, email = siteConfig.defaultAuthor.email } = Astro.props; --- -↩ Reply via Email \ No newline at end of file +↩ Reply via Email \ No newline at end of file diff --git a/src/components/helper/head/Meta.astro b/src/components/helper/head/Meta.astro index 771fcb4..a790d7b 100644 --- a/src/components/helper/head/Meta.astro +++ b/src/components/helper/head/Meta.astro @@ -1,9 +1,17 @@ --- -const { title, description, ogImage = "" } = Astro.props +interface Props { + title: string; + description: string; + author?: string; + ogImage?: string; +} + +const { title, author,description, ogImage = "" } = Astro.props const canonicalURL = new URL(Astro.url.pathname, Astro.site); --- +{author && } {/* Open Graph / Facebook */} diff --git a/src/config.ts b/src/config.ts index 2d6a2e3..709cb5d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,6 +3,11 @@ export const siteConfig = { title: '/var/log/mercury', description: 'A blog about software development, technology, and life.', homepageOgImage: '', + defaultAuthor: { + id: 'd6e4661d', // (optional) an id in the authors.yaml, will override the setting below (if id exists) + name: 'GrassBlock1', + email: 'hi@mercury.info', + }, // features noClientJavaScript: false, // disable client-side javascript, this will: // 1. disable all built-in client-side javascript from rendering @@ -10,7 +15,6 @@ export const siteConfig = { // 3. the comments will be globally disabled // 4. the night mode & back to top will not use Javascript to function // 5. the neko will be force-disabled - authorDefaultEmail: '', // site components navBarItems: [ // additional items in the navbar diff --git a/src/content/config.ts b/src/content/config.ts index c330693..d305fc5 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -3,6 +3,7 @@ import {posts} from './posts/_schemas'; import {pages} from "./pages/_schemas"; import {file} from 'astro/loaders'; import { z } from 'astro:content'; +import {siteConfig} from "../config.ts"; const blogCollection = defineCollection({ type: 'content', @@ -21,8 +22,21 @@ const blogRollData = defineCollection({ }) }); +const authorsData = defineCollection({ + loader: file("src/data/authors.yaml"), + schema: z.object({ + name: z.string().default(siteConfig.defaultAuthor.name), + email: z.string().email().default(siteConfig.defaultAuthor.email), + social: z.object({ + twitter: z.string().optional(), + fediverse: z.string().optional(), + }).optional(), + }) +}); + export const collections = { 'posts': blogCollection, 'pages': pageCollection, 'links': blogRollData, + 'authors': authorsData, }; \ No newline at end of file diff --git a/src/content/posts/_schemas.ts b/src/content/posts/_schemas.ts index e62adfb..bc668d1 100644 --- a/src/content/posts/_schemas.ts +++ b/src/content/posts/_schemas.ts @@ -6,4 +6,5 @@ export const posts = ({ image }) => z.object({ pubDate: z.coerce.date(), updatedDate: z.coerce.date().optional(), cover: image().optional(), + author: z.string().optional(), }); \ No newline at end of file diff --git a/src/content/posts/minimalism/index.md b/src/content/posts/minimalism/index.md index 4ad2c6e..c29b2bd 100644 --- a/src/content/posts/minimalism/index.md +++ b/src/content/posts/minimalism/index.md @@ -2,6 +2,7 @@ title: 'The Art of Minimalism' description: 'Thoughts on minimalism in design and code' pubDate: '2025-06-05' +author: 'Wheatley' --- Minimalism isn't just about having less, it's about making room for what matters. diff --git a/src/data/authors.yaml b/src/data/authors.yaml new file mode 100644 index 0000000..613201f --- /dev/null +++ b/src/data/authors.yaml @@ -0,0 +1,10 @@ +Wheatley: # the key name (id) of the author, which is used in the front matter + name: "Wheatley" # the display name of the author + email: "hello@example.org" # the email address of the author + social: # the social media accounts of the author, if any (there is no reference for this yet except for the twitter handle) + twitter: "@wheatley" + fediverse: "@" + +Glados: # you can have more if you like + name: "Glados" + email: "contact@example.org" \ No newline at end of file diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 6cda7bd..f402f64 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -12,6 +12,7 @@ import Logo from '../assets/mercury.svg' interface Props { title: string; description: string; + author?: string; path?: string; ogImage?: string; } @@ -29,7 +30,7 @@ const navBarItems = siteConfig.navBarItems const customFooter = siteConfig.customFooter const nekoType = siteConfig.neko?.type -const { title = pageTitle, description = siteConfig.description, ogImage = "" } = Astro.props; +const { title = pageTitle, author = siteConfig.defaultAuthor.name,description = siteConfig.description, ogImage = "" } = Astro.props; --- @@ -39,7 +40,7 @@ const { title = pageTitle, description = siteConfig.description, ogImage = "" } - +
Powered by