Clarify News category heading and SEO metadata
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
interface OgMeta {
|
||||
siteName?: string;
|
||||
ogTitle?: string;
|
||||
ogDescription?: string;
|
||||
ogImage?: string;
|
||||
@@ -52,7 +53,7 @@ function setCanonical(href: string) {
|
||||
|
||||
export function usePageMeta(title: string, description?: string, og?: OgMeta) {
|
||||
useEffect(() => {
|
||||
const suffix = " | Folx Music Television";
|
||||
const suffix = ` | ${og?.siteName || "Folx Music Television"}`;
|
||||
document.title = title + suffix;
|
||||
if (description) {
|
||||
setMetaTag('meta[name="description"]', description);
|
||||
@@ -104,5 +105,5 @@ export function usePageMeta(title: string, description?: string, og?: OgMeta) {
|
||||
removeMetaTag('meta[property="article:author"]');
|
||||
removeMetaTag('meta[property="article:section"]');
|
||||
};
|
||||
}, [title, description, og?.ogTitle, og?.ogDescription, og?.ogImage, og?.ogType, og?.ogUrl, og?.articlePublishedTime, og?.articleAuthor, og?.articleSection]);
|
||||
}, [title, description, og?.siteName, og?.ogTitle, og?.ogDescription, og?.ogImage, og?.ogType, og?.ogUrl, og?.articlePublishedTime, og?.articleAuthor, og?.articleSection]);
|
||||
}
|
||||
|
||||
@@ -31,10 +31,20 @@ export default function CategoryPage({ fixedCategory }: { fixedCategory?: string
|
||||
const searchParams = new URLSearchParams(searchString);
|
||||
const currentPage = Math.max(1, parseInt(searchParams.get("page") || "1"));
|
||||
|
||||
usePageMeta(
|
||||
`${category}${currentPage > 1 ? ` – Seite ${currentPage}` : ""} - Volksmusik & Schlager`,
|
||||
`Aktuelle ${category}-Beiträge und Nachrichten aus der Volksmusik- und Schlagerszene. Neueste Volksmusik-Meldungen bei FOLX TV.`
|
||||
);
|
||||
const isNews = category?.toLowerCase() === "news";
|
||||
const heading = isNews ? "Schlager & Volksmusik News" : category;
|
||||
const pageSuffix = currentPage > 1 ? ` – Seite ${currentPage}` : "";
|
||||
const pageTitle = isNews ? `${heading}${pageSuffix}` : `${category}${pageSuffix} - Volksmusik & Schlager`;
|
||||
const description = isNews
|
||||
? "Aktuelle Schlager & Volksmusik News: Nachrichten, Interviews und Neuigkeiten aus der Musikszene bei FOLX TV."
|
||||
: `Aktuelle ${category}-Beiträge und Nachrichten aus der Volksmusik- und Schlagerszene. Neueste Volksmusik-Meldungen bei FOLX TV.`;
|
||||
|
||||
usePageMeta(pageTitle, description, isNews ? {
|
||||
siteName: "FOLX TV",
|
||||
ogTitle: `${pageTitle} | FOLX TV`,
|
||||
ogDescription: description,
|
||||
ogType: "website",
|
||||
} : undefined);
|
||||
|
||||
const { data, isLoading } = useQuery<PaginatedResponse>({
|
||||
queryKey: ["/api/articles/category", category, { page: currentPage }],
|
||||
@@ -127,8 +137,8 @@ export default function CategoryPage({ fixedCategory }: { fixedCategory?: string
|
||||
</Link>
|
||||
|
||||
<div className="flex items-center justify-between gap-2 mb-6 flex-wrap">
|
||||
<h1 className="text-2xl font-bold text-foreground" data-testid="text-category-title">
|
||||
{category}
|
||||
<h1 className="min-w-0 text-2xl font-bold text-foreground break-words" data-testid="text-category-title">
|
||||
{heading}
|
||||
</h1>
|
||||
{data && data.total > 0 && (
|
||||
<span className="text-sm text-muted-foreground" data-testid="text-article-count">
|
||||
|
||||
+9
-3
@@ -402,8 +402,14 @@ export function serveStatic(app: Express) {
|
||||
return;
|
||||
}
|
||||
const catUrl = `${canonicalBase}/category/${encodeURIComponent(cat)}`;
|
||||
const catTitle = `${cat} – Volksmusik & Schlager | Folx Music Television`;
|
||||
const catDesc = `Alle Beiträge aus der Rubrik ${cat} bei FOLX TV: aktuelle Meldungen, Interviews und Videos aus Volksmusik und Schlager.`;
|
||||
const isNews = cat.toLowerCase() === "news";
|
||||
const catHeading = isNews ? "Schlager & Volksmusik News" : cat;
|
||||
const catTitle = isNews
|
||||
? `${catHeading} | FOLX TV`
|
||||
: `${cat} – Volksmusik & Schlager | Folx Music Television`;
|
||||
const catDesc = isNews
|
||||
? "Aktuelle Schlager & Volksmusik News: Nachrichten, Interviews und Neuigkeiten aus der Musikszene bei FOLX TV."
|
||||
: `Alle Beiträge aus der Rubrik ${cat} bei FOLX TV: aktuelle Meldungen, Interviews und Videos aus Volksmusik und Schlager.`;
|
||||
const firstImg = ogImageUrl(list[0]?.coverImage || "", canonicalBase) || `${canonicalBase}/og-image.jpg`;
|
||||
const itemLd = {
|
||||
"@context": "https://schema.org",
|
||||
@@ -445,7 +451,7 @@ export function serveStatic(app: Express) {
|
||||
}
|
||||
const ssr = [
|
||||
'<section class="ssr-content">',
|
||||
`<h1>${escapeHtml(cat)}</h1>`,
|
||||
`<h1>${escapeHtml(catHeading)}</h1>`,
|
||||
"<ul>",
|
||||
...list.map((a: any) => {
|
||||
const img = ogImageUrl(a.coverImage || "", canonicalBase);
|
||||
|
||||
Reference in New Issue
Block a user