- {article.title} + {v.shortTitle}
-- {format(new Date(article.publishedAt), "d. MMMM yyyy", { locale: de })} + {v.teaser && ( +
{v.teaser}
+ )} ++ {format(new Date(v.publishedAt), "d. MMMM yyyy", { locale: de })}
+
Videos
- {isLoading ? (
-
- {Array.from({ length: 8 }).map((_, i) => (
-
+ {rubriken.length > 1 && (
+
+ {rubriken.map((r) => (
+
))}
- ) : articles.length > 0 ? (
- <>
-
- {articles.flatMap((article, index) => {
- const items: JSX.Element[] = [
- ,
- ];
- if ((index + 1) % 3 === 0) {
- items.push( );
- }
- return items;
- })}
-
+ )}
- {totalPages > 1 && (
-
- )}
- >
+ {isLoading ? (
+
+ {Array.from({ length: 8 }).map((_, i) => )}
+
+ ) : items.length === 0 ? (
+ Zurzeit keine Videos in dieser Rubrik.
) : (
-
- Noch keine Videos vorhanden.
+
+ {items.map((v) => )}
)}
-
- Anzeige
-
-
-
+
+
+
+ {totalPages > 1 && (
+
+
+ {pageNumbers().map((p, i) =>
+ p === "..." ? (
+ …
+ ) : (
+
+ ),
+ )}
+
+
+ )}
+
);
diff --git a/server/routes.ts b/server/routes.ts
index 5b761c2..1fdd20a 100644
--- a/server/routes.ts
+++ b/server/routes.ts
@@ -111,6 +111,7 @@ export async function registerRoutes(
"",
`Sitemap: ${SITE}/sitemap.xml`,
`Sitemap: ${SITE}/news-sitemap.xml`,
+ `Sitemap: ${SITE}/video-sitemap.xml`,
"",
].join("\n")
);
@@ -155,6 +156,9 @@ export async function registerRoutes(
const lastmod = a.publishedAt ? new Date(a.publishedAt as any).toISOString() : new Date().toISOString();
urls.push(` \n ${SITE}/article/${xmlEscape(a.slug)} \n ${lastmod} \n weekly \n 0.8 \n `);
}
+ for (const v of ytItems()) {
+ urls.push(` \n ${SITE}/video/${xmlEscape(v.slug)} \n ${new Date(v.publishedAt).toISOString()} \n weekly \n 0.8 \n `);
+ }
const xml = `\n\n${urls.join("\n")}\n `;
res.type("application/xml").send(xml);
} catch (e) {
@@ -162,6 +166,30 @@ export async function registerRoutes(
}
});
+ // Video sitemap: Google ga bere posebej in iz njega ve, katere strani nosijo
+ // video. Vsak vnos kaze na naso stran, predvajalnik pa je YouTube.
+ app.get("/video-sitemap.xml", (_req, res) => {
+ try {
+ const urls = ytItems().map((v) => {
+ const page = `${SITE}/video/${xmlEscape(v.slug)}`;
+ return ` \n ${page} \n \n` +
+ ` ${SITE}${xmlEscape(v.posterUrl)} \n` +
+ ` ${xmlEscape(v.shortTitle)} \n` +
+ ` ${xmlEscape((v.teaser || v.shortTitle).slice(0, 1900))} \n` +
+ ` ${xmlEscape(v.embedUrl || `https://www.youtube-nocookie.com/embed/${v.ytId}`)} \n` +
+ ` ${v.durationS || 0} \n` +
+ ` ${new Date(v.publishedAt).toISOString()} \n` +
+ ` yes \n` +
+ ` no \n` +
+ ` \n `;
+ });
+ const xml = `\n\n${urls.join("\n")}\n `;
+ res.type("application/xml").send(xml);
+ } catch (e) {
+ res.status(500).type("application/xml").send(' ');
+ }
+ });
+
app.get("/news-sitemap.xml", async (_req, res) => {
try {
const articles = await storage.getArticles();
@@ -1150,6 +1178,7 @@ Disallow: /search
Disallow: /admin/
Sitemap: https://folx.tv/sitemap.xml
+Sitemap: https://folx.tv/video-sitemap.xml
`;
res.set("Content-Type", "text/plain");
res.set("Cache-Control", "public, max-age=86400");
diff --git a/server/static.ts b/server/static.ts
index bed74fa..e46fa67 100644
--- a/server/static.ts
+++ b/server/static.ts
@@ -131,16 +131,18 @@ export function serveStatic(app: Express) {
const pageUrl = `${canonicalBase}/video/${v.slug}`;
const poster = `${canonicalBase}${v.posterUrl}`;
const desc = (v.teaser || v.shortTitle || v.title).slice(0, 300);
- const mins = Math.floor(v.previewS / 60), secs = v.previewS % 60;
+ const mins = Math.floor((v.durationS || 0) / 60), secs = (v.durationS || 0) % 60;
+ const embedUrl = v.embedUrl || `https://www.youtube-nocookie.com/embed/${v.ytId}`;
const videoLd = {
"@context": "https://schema.org",
"@type": "VideoObject",
- "name": `${v.shortTitle} \u2013 Vorschau`,
+ "name": v.shortTitle,
"description": desc,
"thumbnailUrl": [poster],
"uploadDate": v.publishedAt,
"duration": `PT${mins}M${secs}S`,
- "contentUrl": `${canonicalBase}${v.previewUrl}`,
+ "embedUrl": embedUrl,
+ "contentUrl": v.youtubeUrl,
"isFamilyFriendly": true,
"inLanguage": "de",
"publisher": {
@@ -177,7 +179,7 @@ export function serveStatic(app: Express) {
const ssr = [
'',
`${escapeHtml(v.shortTitle)}
`,
- ``,
+ ``,
`${escapeHtml(desc)}
`,
chapterHtml,
``,
Zurzeit keine Videos in dieser Rubrik.
) : ( -Noch keine Videos vorhanden.
+${escapeHtml(v.shortTitle)}
`, - ``, + ``, `${escapeHtml(desc)}
`, chapterHtml, ``,