From 607a7720e5c7e12d6c78a0ff03da31788e2fd270 Mon Sep 17 00:00:00 2001
From: Ayo
Date: Wed, 25 Feb 2026 20:41:52 +0100
Subject: [PATCH] feat: use mastodon account avatar as og:image
---
src/components/Head.astro | 6 +++++-
src/layouts/Layout.astro | 25 ++++++++++++++++++++++---
2 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/components/Head.astro b/src/components/Head.astro
index e3bdc64..f00621c 100644
--- a/src/components/Head.astro
+++ b/src/components/Head.astro
@@ -3,17 +3,20 @@ export interface Props {
title?: string | undefined
description?: string | undefined
ogImage?: string | undefined
+ ogFileType?: string | undefined
}
const defaultDescription =
'Professional software engineer specializing in web development with a decade of experience building web applications for both private businesses and government-funded high-impact projects utilizing web technologies, IoT, data viz/insights, remote sensing, and GIS'
const defaultTitle = 'Ayo Ayco - Tech Leader, Software Engineer, Web Developer'
const defaultOgImage = 'ayo.png'
+const defaultOgFileType = 'image/png'
let {
title,
description = defaultDescription,
ogImage = defaultOgImage,
+ ogFileType = defaultOgFileType,
} = Astro.props
const baseURL = Astro.site?.toString().slice(0, -1) // ?? 'https://ayo.ayco.io'
@@ -35,7 +38,8 @@ const baseURL = Astro.site?.toString().slice(0, -1) // ?? 'https://ayo.ayco.io'
-
+
+
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index e9a9ba9..f65e6ed 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -8,15 +8,34 @@ import { links } from '../constants/links'
export interface Props {
title?: string
description?: string
- ogImage?: string
}
-const { title, description, ogImage } = Astro.props
+const { title, description } = Astro.props
+import { getImage } from 'astro:assets'
+
+// fetch mastodon account
+const response = await fetch(
+ 'https://social.ayco.io/api/v1/accounts/lookup?acct=ayo'
+)
+const data = await response.json()
+const { avatar } = data
+const ogImage = await getImage({
+ src: avatar,
+ width: 400,
+ height: 400,
+ format: 'png',
+})
+const ogFileType = 'image/png'
---
-
+