mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 12:05:28 +00:00
feat: add schema.org data
This commit is contained in:
@@ -1,9 +1,30 @@
|
||||
---
|
||||
import { site } from '../data/site';
|
||||
|
||||
import GridLayout from './GridLayout.astro';
|
||||
import PageTitle from '../components/PageTitle.astro';
|
||||
import Picture from '../components/Picture.astro';
|
||||
|
||||
const { frontmatter } = Astro.props;
|
||||
const schema = JSON.stringify({
|
||||
'@context': 'https://schema.org/',
|
||||
'@type': 'Person',
|
||||
name: site.author,
|
||||
url: site.url,
|
||||
image: site.url + '/assets/images/ai-portrait-stefan-imhoff.png',
|
||||
jobTitle: 'Senior Software Engineer',
|
||||
worksFor: {
|
||||
'@type': 'Organization',
|
||||
name: 'NEW WORK SE',
|
||||
},
|
||||
sameAs: [
|
||||
'https://twitter.com/kogakure',
|
||||
'https://www.instagram.com/kogakure/',
|
||||
'https://www.youtube.com/@kogakure',
|
||||
'https://www.linkedin.com/in/kogakure/',
|
||||
'https://github.com/kogakure',
|
||||
],
|
||||
});
|
||||
---
|
||||
|
||||
<GridLayout title={frontmatter.title} grid="narrow" {...frontmatter}>
|
||||
@@ -22,4 +43,5 @@ const { frontmatter } = Astro.props;
|
||||
/>
|
||||
</div>
|
||||
<slot />
|
||||
<script type="application/ld+json" set:html={schema} />
|
||||
</GridLayout>
|
||||
|
||||
@@ -35,6 +35,13 @@ const fullTitle = `${title} · ${site.description}`;
|
||||
const fullDescription = description || site.description;
|
||||
const fullUrl = site.url + currentPath;
|
||||
const fullImage = site.url + cover;
|
||||
|
||||
const schema = JSON.stringify({
|
||||
'@context': 'https://schema.org/',
|
||||
'@type': 'WebSite',
|
||||
name: site.author,
|
||||
url: site.url,
|
||||
});
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -167,6 +174,7 @@ const fullImage = site.url + cover;
|
||||
'👋 I see you’re interested in the source code of this site? You can find it here 👉 https://github.com/kogakure/website-astro-stefanimhoff.de'
|
||||
);
|
||||
</script>
|
||||
<script type="application/ld+json" set:html={schema} />
|
||||
<style is:global>
|
||||
.astro-code {
|
||||
@apply overflow-auto rounded-2 p-[1em] font-mono text-code mbe-10 mbs-0;
|
||||
|
||||
@@ -3,6 +3,8 @@ import cx from 'classnames';
|
||||
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
import { site } from '../data/site';
|
||||
|
||||
import { formatPosts, sortByDate } from '../utils';
|
||||
import { dateToFormat, dateToISO, wordCount } from '../utils';
|
||||
|
||||
@@ -46,6 +48,31 @@ seriesEntries.sort(sortByDate).reverse();
|
||||
|
||||
const title = entry.data.title;
|
||||
const description = entry.data.description;
|
||||
|
||||
const schema = JSON.stringify({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Article',
|
||||
headline: entry.data.title,
|
||||
description: entry.data.description,
|
||||
datePublished: entry.data.date,
|
||||
dateModified: entry.data.updated,
|
||||
image: [
|
||||
entry.data.cover
|
||||
? site.url + entry.data.cover
|
||||
: `${site.url}/assets/images/branding/og/bonsai.jpg`,
|
||||
],
|
||||
author: [
|
||||
{
|
||||
'@type': 'Person',
|
||||
name: entry.data.author || site.author,
|
||||
url: `${site.url}/about`,
|
||||
},
|
||||
],
|
||||
mainEntityOfPage: {
|
||||
'@type': 'webPage',
|
||||
id: `${site.url}/${entry.slug}/}`,
|
||||
},
|
||||
});
|
||||
---
|
||||
|
||||
<GridLayout
|
||||
@@ -144,6 +171,8 @@ const description = entry.data.description;
|
||||
/>
|
||||
</GridLayout>
|
||||
|
||||
<script type="application/ld+json" set:html={schema} />
|
||||
|
||||
<style is:global>
|
||||
.journal-post {
|
||||
& > h2 {
|
||||
|
||||
Reference in New Issue
Block a user