mirror of
https://github.com/jaronpate/folio.git
synced 2026-10-19 01:07:39 +00:00
added json-ld
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
const route = useRoute();
|
||||
const siteUrl = 'https://jaron.sh';
|
||||
const personId = `${siteUrl}/#person`;
|
||||
const articleUrl = `${siteUrl}${route.path}`;
|
||||
const { data: page } = await useAsyncData(route.path, () => {
|
||||
return queryCollection('writing')
|
||||
.path(route.path.replace('/writing/', ''))
|
||||
@@ -18,6 +21,33 @@ useSeoMeta({
|
||||
ogUrl: useRequestURL().href,
|
||||
});
|
||||
|
||||
useHead({
|
||||
script: [
|
||||
{
|
||||
key: 'json-ld-article',
|
||||
type: 'application/ld+json',
|
||||
innerHTML: JSON.stringify({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'BlogPosting',
|
||||
'@id': `${articleUrl}#article`,
|
||||
url: articleUrl,
|
||||
headline: page.value.title,
|
||||
description: page.value.description,
|
||||
datePublished: new Date(page.value.date).toISOString(),
|
||||
dateModified: new Date(page.value.date).toISOString(),
|
||||
inLanguage: 'en-US',
|
||||
isPartOf: { '@id': `${siteUrl}/#website` },
|
||||
mainEntityOfPage: {
|
||||
'@type': 'WebPage',
|
||||
'@id': articleUrl,
|
||||
},
|
||||
author: { '@id': personId },
|
||||
publisher: { '@id': personId },
|
||||
}),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
definePageMeta({
|
||||
layout: false,
|
||||
});
|
||||
|
||||
@@ -4,6 +4,40 @@
|
||||
// );
|
||||
const pages: any[] = [];
|
||||
|
||||
const siteUrl = 'https://jaron.sh';
|
||||
const writingUrl = `${siteUrl}/writing`;
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
useHead({
|
||||
script: [
|
||||
{
|
||||
key: 'json-ld-writing',
|
||||
type: 'application/ld+json',
|
||||
innerHTML: JSON.stringify({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'CollectionPage',
|
||||
'@id': `${writingUrl}#collection`,
|
||||
url: writingUrl,
|
||||
name: 'Writing',
|
||||
description:
|
||||
"Thoughts I've had here and there. Maybe you'll find something helpful or interesting here.",
|
||||
inLanguage: 'en-US',
|
||||
isPartOf: { '@id': `${siteUrl}/#website` },
|
||||
author: { '@id': `${siteUrl}/#person` },
|
||||
}),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const formatDate = (dateString: string) => {
|
||||
const date = new Date(dateString);
|
||||
// ex. May 5, 2026
|
||||
|
||||
Reference in New Issue
Block a user