Add structured data for news and improved social sharing

Implement NewsArticle schema and Open Graph tags on article pages for better search engine visibility and social media previews, and add WebSite schema to the homepage.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 23852c00-4779-460a-9e0c-d09fee4b6c92
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: b02ed261-705f-4f15-a1ae-b9b80b538081
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/23852c00-4779-460a-9e0c-d09fee4b6c92/koutl3W
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic
2026-03-06 14:17:59 +00:00
parent bc389539d0
commit bb5617b394
3 changed files with 149 additions and 8 deletions
+57 -1
View File
@@ -101,11 +101,67 @@ export default function ArticlePage() {
queryKey: ["/api/articles", slug],
});
const articleUrl = article ? `${window.location.origin}/article/${article.slug}` : "";
const articleImage = article?.coverImage
? (article.coverImage.startsWith("http") ? article.coverImage : `${window.location.origin}${article.coverImage}`)
: "";
usePageMeta(
article ? `${article.title} - Volksmusik & Schlager` : "Volksmusik & Schlager Artikel",
article?.excerpt || "Aktuelle Nachrichten aus der Volksmusik- und Schlagerszene bei FOLX TV."
article?.excerpt || "Aktuelle Nachrichten aus der Volksmusik- und Schlagerszene bei FOLX TV.",
article ? {
ogTitle: article.title,
ogDescription: article.excerpt,
ogImage: articleImage || undefined,
ogType: "article",
ogUrl: articleUrl,
} : undefined
);
useEffect(() => {
if (!article) return;
const jsonLd = {
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": article.title,
"description": article.excerpt,
"image": articleImage ? [articleImage] : [],
"datePublished": new Date(article.publishedAt).toISOString(),
"dateModified": new Date(article.publishedAt).toISOString(),
"author": {
"@type": "Organization",
"name": article.author || "Folx Music Television",
"url": "https://folx.tv"
},
"publisher": {
"@type": "Organization",
"name": "Folx Music Television",
"url": "https://folx.tv",
"logo": {
"@type": "ImageObject",
"url": `${window.location.origin}/favicon.png`
}
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": articleUrl
},
"articleSection": article.category || "News",
"inLanguage": "de"
};
const script = document.createElement("script");
script.type = "application/ld+json";
script.id = "article-jsonld";
script.textContent = JSON.stringify(jsonLd);
const existing = document.getElementById("article-jsonld");
if (existing) existing.remove();
document.head.appendChild(script);
return () => {
const el = document.getElementById("article-jsonld");
if (el) el.remove();
};
}, [article, articleUrl, articleImage]);
useEffect(() => {
window.scrollTo(0, 0);
}, [slug]);
+33
View File
@@ -511,6 +511,39 @@ function BentoSkeleton() {
export default function Home() {
usePageMeta("Volksmusik & Schlager", "FOLX TV – Aktuelle Nachrichten, Musikvideos und Interviews aus der Welt der Volksmusik und des Schlagers.");
useEffect(() => {
const jsonLd = {
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Folx Music Television",
"alternateName": "FOLX TV",
"url": "https://folx.tv",
"description": "FOLX TV – Aktuelle Nachrichten, Musikvideos und Interviews aus der Welt der Volksmusik und des Schlagers.",
"publisher": {
"@type": "Organization",
"name": "Folx Music Television",
"url": "https://folx.tv",
"logo": {
"@type": "ImageObject",
"url": `${window.location.origin}/favicon.png`
}
},
"inLanguage": "de"
};
const script = document.createElement("script");
script.type = "application/ld+json";
script.id = "home-jsonld";
script.textContent = JSON.stringify(jsonLd);
const existing = document.getElementById("home-jsonld");
if (existing) existing.remove();
document.head.appendChild(script);
return () => {
const el = document.getElementById("home-jsonld");
if (el) el.remove();
};
}, []);
const { data: articles, isLoading } = useQuery<Article[]>({
queryKey: ["/api/articles"],
});