feat: add schema.org data

This commit is contained in:
Stefan Imhoff
2023-06-12 19:12:23 +02:00
parent f5b944833c
commit c957688809
3 changed files with 59 additions and 0 deletions

View File

@@ -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>

View File

@@ -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 youre 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;