feat: move static seo tags to nuxt config

This commit is contained in:
2026-02-25 21:57:29 +01:00
parent 0d8714a280
commit 34f966abeb
2 changed files with 70 additions and 78 deletions

View File

@@ -1,89 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
const TITLE = "Pihkaal"; const { locale } = useI18n();
const DESCRIPTION =
"23yo developer from Brittany. I love programming and taking photos.";
const URL = "https://pihkaal.me";
const IMAGE = `${URL}/thumbnail.png`;
const { locale, locales } = useI18n();
const app = useAppStore(); const app = useAppStore();
const pageTitle = computed(() => { const pageTitle = computed(() => {
if (!app.booted) return TITLE; if (!app.booted) return "Pihkaal";
const name = app.screen.charAt(0).toUpperCase() + app.screen.slice(1); const name = app.screen.charAt(0).toUpperCase() + app.screen.slice(1);
return `${name} - Pihkaal`; return `${name} - Pihkaal`;
}); });
const ogLocale = computed(
() => locales.value.find((l) => l.code === locale.value)?.language ?? "en-US",
);
const ogLocaleAlternate = computed(() =>
locales.value.filter((l) => l.code !== locale.value).map((l) => l.language!),
);
useSeoMeta({
title: pageTitle,
description: DESCRIPTION,
author: "pihkaal",
robots: "index, follow",
ogType: "website",
ogTitle: TITLE,
ogDescription: DESCRIPTION,
ogImage: IMAGE,
ogImageType: "image/png",
ogImageWidth: 1200,
ogImageHeight: 630,
ogUrl: URL,
ogSiteName: TITLE,
ogLocale,
ogLocaleAlternate,
themeColor: "#181818",
twitterCard: "summary_large_image",
twitterTitle: TITLE,
twitterDescription: DESCRIPTION,
twitterImage: IMAGE,
});
useHead({ useHead({
title: pageTitle,
htmlAttrs: { lang: locale }, htmlAttrs: { lang: locale },
link: [{ rel: "canonical", href: URL }],
script: [
{
type: "application/ld+json",
innerHTML: JSON.stringify({
"@context": "https://schema.org",
"@type": "Person",
name: "pihkaal",
url: URL,
email: "hello@pihkaal.me",
jobTitle: "Full-Stack Developer",
description: DESCRIPTION,
image: IMAGE,
sameAs: [
"https://git.pihkaal.me",
"https://linkedin.com/in/stevancorre/",
],
}),
},
{
type: "application/ld+json",
innerHTML: JSON.stringify({
"@context": "https://schema.org",
"@type": "WebSite",
name: TITLE,
url: URL,
description: DESCRIPTION,
author: {
"@type": "Person",
name: "pihkaal",
url: URL,
},
}),
},
],
}); });
</script> </script>

View File

@@ -1,4 +1,9 @@
// https://nuxt.com/docs/api/configuration/nuxt-config const TITLE = "Pihkaal";
const DESCRIPTION =
"23yo developer from Brittany. I love programming and taking photos.";
const URL = "https://pihkaal.me";
const IMAGE = `${URL}/thumbnail.png`;
export default defineNuxtConfig({ export default defineNuxtConfig({
compatibilityDate: "2025-07-15", compatibilityDate: "2025-07-15",
devtools: { enabled: true }, devtools: { enabled: true },
@@ -15,7 +20,67 @@ export default defineNuxtConfig({
], ],
app: { app: {
head: { head: {
link: [{ rel: "icon", type: "image/svg+xml", href: "/favicon.svg" }], title: TITLE,
link: [
{ rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
{ rel: "canonical", href: URL },
],
meta: [
{ name: "description", content: DESCRIPTION },
{ name: "author", content: "pihkaal" },
{ name: "robots", content: "index, follow" },
{ name: "theme-color", content: "#181818" },
{ property: "og:type", content: "website" },
{ property: "og:title", content: TITLE },
{ property: "og:description", content: DESCRIPTION },
{ property: "og:image", content: IMAGE },
{ property: "og:image:type", content: "image/png" },
{ property: "og:image:width", content: "1200" },
{ property: "og:image:height", content: "630" },
{ property: "og:image:alt", content: "3D Nintendo DS home screen from pihkaal.me" },
{ property: "og:url", content: URL },
{ property: "og:site_name", content: TITLE },
{ property: "og:locale", content: "en-US" },
{ property: "og:locale:alternate", content: "de-DE" },
{ property: "og:locale:alternate", content: "fr-FR" },
{ property: "og:locale:alternate", content: "es-ES" },
{ property: "og:locale:alternate", content: "it-IT" },
{ property: "og:locale:alternate", content: "ja-JP" },
{ name: "twitter:card", content: "summary_large_image" },
{ name: "twitter:title", content: TITLE },
{ name: "twitter:description", content: DESCRIPTION },
{ name: "twitter:image", content: IMAGE },
],
script: [
{
type: "application/ld+json",
innerHTML: JSON.stringify({
"@context": "https://schema.org",
"@type": "Person",
name: "pihkaal",
url: URL,
email: "hello@pihkaal.me",
jobTitle: "Full-Stack Developer",
description: DESCRIPTION,
image: IMAGE,
sameAs: [
"https://git.pihkaal.me",
"https://linkedin.com/in/stevancorre/",
],
}),
},
{
type: "application/ld+json",
innerHTML: JSON.stringify({
"@context": "https://schema.org",
"@type": "WebSite",
name: TITLE,
url: URL,
description: DESCRIPTION,
author: { "@type": "Person", name: "pihkaal", url: URL },
}),
},
],
}, },
}, },
css: ["~/assets/app.css"], css: ["~/assets/app.css"],