add structured data scheme

This commit is contained in:
MuslemRahimi 2025-04-15 11:43:15 +02:00
parent 757e0e8628
commit 739fee2c6d
4 changed files with 82 additions and 5 deletions

View File

@ -0,0 +1,43 @@
<script lang="ts">
export let title: string;
export let datePublished: string;
export let dateModified: string;
export let image: string | undefined;
export let url: string;
</script>
{@html `<script type="application/ld+json">
[{
"@context": "https://schema.org",
"@type": "Article",
"headline": "${title}",
${
image &&
`"image": [
"${image}"
],`
}
"datePublished": "${datePublished}",
"dateModified": "${dateModified}",
"author": [{
"@type": "Person",
"name": "Jack Landon",
"url": "https://stocknear.com/about"
}]
},
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Blog",
"item": "https://stocknear.com/${url}
},{
"@type": "ListItem",
"position": 2,
"name": "${title}"
}]
}
]
</script>`}

View File

@ -0,0 +1,25 @@
<script lang="ts">
export let faqs: {
question: string;
answer: string;
}[];
let mappedFaqs = faqs.map((faq, index) => {
return `{
"@type": "Question",
"name": "${faq.question}",
"acceptedAnswer": {
"@type": "Answer",
"text": "${faq.answer}"
}
}`;
});
</script>
{@html `<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [${mappedFaqs}]
}
</script>`}

View File

@ -236,14 +236,12 @@
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
<div class="border-b border-gray-700 w-full pb-2">Made in EU 🇪🇺</div> <div class="border-b border-gray-700 w-full"></div>
<div <div
class="flex flex-col sm:flex-row sm:justify-between items-start sm:items-center mt-6 text-md text-gray-300 mb-5" class="flex flex-col sm:flex-row sm:justify-between items-start sm:items-center mt-6 text-md text-gray-300 mb-5"
> >
<span class="mb-2 sm:mb-0">Stocknear is 100% Open Source⚡ </span> <span class="mb-2 sm:mb-0 inline-block"> Made in EU 🇪🇺</span>
<span class="hidden sm:inline-block"> <span class="">Stocknear is 100% Open Source⚡ </span>
© 2025 Stocknear. All Rights Reserved.
</span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,6 +1,7 @@
<script> <script>
import { getImageURL } from "$lib/utils"; import { getImageURL } from "$lib/utils";
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
import ArticleBreadcrumbStructuredData from "$lib/components/ArticleBreadcrumbStructuredData.svelte";
export let data; export let data;
let article = data?.getArticle; let article = data?.getArticle;
@ -20,6 +21,16 @@
: ""} : ""}
/> />
<ArticleBreadcrumbStructuredData
title={article?.title}
datePublished={article.created}
dateModified={article?.updated}
url={`blog/article/${data?.getParams}`}
image={article?.cover
? getImageURL(article?.collectionId, article?.id, article?.cover)
: ""}
/>
<section <section
class="w-full max-w-3xl sm:max-w-[1400px] overflow-hidden min-h-screen pb-20 pt-3 px-4 lg:px-3" class="w-full max-w-3xl sm:max-w-[1400px] overflow-hidden min-h-screen pb-20 pt-3 px-4 lg:px-3"
> >