Update SEO shit

This commit is contained in:
2026-07-30 09:21:34 -05:00
parent 9df312a99f
commit a8b424b285
6 changed files with 231 additions and 130 deletions
+34 -18
View File
@@ -5,19 +5,35 @@ let sectionsRevealed = false;
<script setup lang="ts">
import { ref } from 'vue';
import {
DEFAULT_DESCRIPTION,
DEFAULT_IMAGE,
DEFAULT_TITLE,
SITE_URL,
personId,
personSchema,
websiteId,
} from '~/utils/site';
const siteUrl = 'https://jaron.sh';
const currentUrl = useRequestURL().href;
const personId = `${siteUrl}/#person`;
const websiteId = `${siteUrl}/#website`;
const webpageId = `${siteUrl}/#homepage`;
const webpageId = `${SITE_URL}/#homepage`;
useSeoMeta({
title: "Hey, I'm Jaron.",
ogTitle: "Hey, I'm Jaron.",
description: 'Developer. Reformed Rust enjoyer, Golang padawan.',
ogDescription: 'Developer. Reformed Rust enjoyer, Golang padawan.',
ogUrl: currentUrl,
title: DEFAULT_TITLE,
ogTitle: DEFAULT_TITLE,
description: DEFAULT_DESCRIPTION,
ogDescription: DEFAULT_DESCRIPTION,
ogUrl: SITE_URL,
ogType: 'profile',
ogImage: DEFAULT_IMAGE,
ogImageAlt: DEFAULT_TITLE,
twitterCard: 'summary',
twitterTitle: DEFAULT_TITLE,
twitterDescription: DEFAULT_DESCRIPTION,
twitterImage: DEFAULT_IMAGE,
});
useHead({
link: [{ rel: 'canonical', href: SITE_URL }],
});
const titles = [
@@ -118,17 +134,18 @@ useHead({
{
'@type': 'ProfilePage',
'@id': webpageId,
url: siteUrl,
name: "Hey, I'm Jaron.",
description:
'Developer. Reformed Rust enjoyer, Golang padawan.',
url: SITE_URL,
name: DEFAULT_TITLE,
description: DEFAULT_DESCRIPTION,
inLanguage: 'en-US',
isPartOf: { '@id': websiteId },
about: { '@id': personId },
mainEntity: { '@id': personId },
// Google requires mainEntity to be an inline Person with name —
// a bare @id reference fails Rich Results validation.
mainEntity: personSchema(),
primaryImageOfPage: {
'@type': 'ImageObject',
url: `${siteUrl}/favicon.png`,
url: DEFAULT_IMAGE,
},
},
{
@@ -155,12 +172,11 @@ useHead({
'@type': 'ListItem',
position: index + 1,
item: {
'@type': 'SoftwareApplication',
'@type': 'CreativeWork',
name: project.title,
description: project.description,
url: project.href,
author: { '@id': personId },
applicationCategory: 'DeveloperApplication',
},
})),
},
+54 -22
View File
@@ -1,12 +1,17 @@
<script lang="ts" setup>
import {
DEFAULT_IMAGE,
SITE_NAME,
SITE_URL,
personId,
websiteId,
} from '~/utils/site';
const route = useRoute();
const siteUrl = 'https://jaron.sh';
const personId = `${siteUrl}/#person`;
const websiteId = `${siteUrl}/#website`;
const articleUrl = `${siteUrl}${route.path}`;
const articleUrl = `${SITE_URL}${route.path}`;
const webpageId = `${articleUrl}#webpage`;
const articleId = `${articleUrl}#article`;
const blogId = `${siteUrl}/writing#blog`;
const blogId = `${SITE_URL}/writing#blog`;
const { data: page } = await useAsyncData(route.path, () => {
return queryCollection('writing')
.path(route.path.replace('/writing/', ''))
@@ -17,15 +22,29 @@ if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page Not Found' });
}
const articleTitle = page.value.title;
const articleDescription = page.value.description;
useSeoMeta({
title: page.value?.title,
ogTitle: page.value?.title,
description: page.value?.description,
ogDescription: page.value?.description,
ogUrl: useRequestURL().href,
title: articleTitle,
ogTitle: articleTitle,
description: articleDescription,
ogDescription: articleDescription,
ogUrl: articleUrl,
ogType: 'article',
ogImage: DEFAULT_IMAGE,
ogImageAlt: articleTitle,
twitterCard: 'summary',
twitterTitle: articleTitle,
twitterDescription: articleDescription,
twitterImage: DEFAULT_IMAGE,
articlePublishedTime: new Date(page.value.date).toISOString(),
articleModifiedTime: new Date(page.value.date).toISOString(),
articleAuthor: [SITE_NAME],
});
useHead({
link: [{ rel: 'canonical', href: articleUrl }],
script: [
{
key: 'json-ld-article',
@@ -37,8 +56,8 @@ useHead({
'@type': 'WebPage',
'@id': webpageId,
url: articleUrl,
name: page.value.title,
description: page.value.description,
name: articleTitle,
description: articleDescription,
inLanguage: 'en-US',
isPartOf: { '@id': websiteId },
breadcrumb: { '@id': `${articleUrl}#breadcrumb` },
@@ -47,30 +66,43 @@ useHead({
{
'@type': 'Blog',
'@id': blogId,
url: `${siteUrl}/writing`,
url: `${SITE_URL}/writing`,
name: 'Jaron Pate Writing',
inLanguage: 'en-US',
isPartOf: { '@id': websiteId },
publisher: { '@id': personId },
publisher: {
'@type': 'Person',
'@id': personId,
name: SITE_NAME,
},
},
{
'@type': 'BlogPosting',
'@id': articleId,
url: articleUrl,
headline: page.value.title,
description: page.value.description,
headline: articleTitle,
description: articleDescription,
datePublished: new Date(page.value.date).toISOString(),
dateModified: new Date(page.value.date).toISOString(),
image: {
'@type': 'ImageObject',
'@id': `${articleUrl}#article-image`,
url: `${siteUrl}/favicon.png`,
url: DEFAULT_IMAGE,
},
inLanguage: 'en-US',
isPartOf: { '@id': blogId },
mainEntityOfPage: { '@id': webpageId },
author: { '@id': personId },
publisher: { '@id': personId },
author: {
'@type': 'Person',
'@id': personId,
name: SITE_NAME,
url: SITE_URL,
},
publisher: {
'@type': 'Person',
'@id': personId,
name: SITE_NAME,
},
},
{
'@type': 'BreadcrumbList',
@@ -80,18 +112,18 @@ useHead({
'@type': 'ListItem',
position: 1,
name: 'Home',
item: siteUrl,
item: SITE_URL,
},
{
'@type': 'ListItem',
position: 2,
name: 'Writing',
item: `${siteUrl}/writing`,
item: `${SITE_URL}/writing`,
},
{
'@type': 'ListItem',
position: 3,
name: page.value.title,
name: articleTitle,
item: articleUrl,
},
],
+40 -20
View File
@@ -1,28 +1,42 @@
<script setup lang="ts">
import {
DEFAULT_IMAGE,
SITE_NAME,
SITE_URL,
personId,
websiteId,
} from '~/utils/site';
// const { data: pages } = await useAsyncData('writing-pages', () =>
// queryCollection('writing').order('date', 'DESC').all(),
// );
const pages = ref([]);
const siteUrl = 'https://jaron.sh';
const writingUrl = `${siteUrl}/writing`;
const personId = `${siteUrl}/#person`;
const websiteId = `${siteUrl}/#website`;
const writingUrl = `${SITE_URL}/writing`;
const collectionId = `${writingUrl}#collection`;
const blogId = `${writingUrl}#blog`;
const writingTitle = 'Writing';
const writingDescription =
"Thoughts I've had here and there. Maybe you'll find something helpful or interesting here.";
useSeoMeta({
title: 'Writing',
ogTitle: 'Writing',
description:
"Thoughts I've had here and there. Maybe you'll find something helpful or interesting here.",
ogDescription:
"Thoughts I've had here and there. Maybe you'll find something helpful or interesting here.",
ogUrl: useRequestURL().href,
title: writingTitle,
ogTitle: writingTitle,
description: writingDescription,
ogDescription: writingDescription,
ogUrl: writingUrl,
ogType: 'website',
ogImage: DEFAULT_IMAGE,
ogImageAlt: writingTitle,
twitterCard: 'summary',
twitterTitle: writingTitle,
twitterDescription: writingDescription,
twitterImage: DEFAULT_IMAGE,
});
useHead({
link: [{ rel: 'canonical', href: writingUrl }],
script: [
{
key: 'json-ld-writing',
@@ -34,12 +48,15 @@ useHead({
'@type': 'CollectionPage',
'@id': collectionId,
url: writingUrl,
name: 'Writing',
description:
"Thoughts I've had here and there. Maybe you'll find something helpful or interesting here.",
name: writingTitle,
description: writingDescription,
inLanguage: 'en-US',
isPartOf: { '@id': websiteId },
author: { '@id': personId },
author: {
'@type': 'Person',
'@id': personId,
name: SITE_NAME,
},
mainEntity: { '@id': blogId },
breadcrumb: { '@id': `${collectionId}#breadcrumb` },
},
@@ -48,11 +65,14 @@ useHead({
'@id': blogId,
url: writingUrl,
name: 'Jaron Pate Writing',
description:
"Thoughts I've had here and there. Maybe you'll find something helpful or interesting here.",
description: writingDescription,
inLanguage: 'en-US',
isPartOf: { '@id': websiteId },
publisher: { '@id': personId },
publisher: {
'@type': 'Person',
'@id': personId,
name: SITE_NAME,
},
blogPost: (pages.value ?? []).map((page) => ({
'@id': `${writingUrl}/${page.path}#article`,
})),
@@ -78,12 +98,12 @@ useHead({
'@type': 'ListItem',
position: 1,
name: 'Home',
item: siteUrl,
item: SITE_URL,
},
{
'@type': 'ListItem',
position: 2,
name: 'Writing',
name: writingTitle,
item: writingUrl,
},
],