video sekcija: YouTube predvajalnik na strani (Google zahteva predvajljiv video za indeksiranje, oglasi tecejo YouTubov), VideoObject kaze na cel video; /videos je zdaj mreza YouTube videov z rubrikami; video-sitemap.xml in vpis v robots; ingest brez napovednika (samo metapodatki in naslovnica)
This commit is contained in:
@@ -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(` <url>\n <loc>${SITE}/article/${xmlEscape(a.slug)}</loc>\n <lastmod>${lastmod}</lastmod>\n <changefreq>weekly</changefreq>\n <priority>0.8</priority>\n </url>`);
|
||||
}
|
||||
for (const v of ytItems()) {
|
||||
urls.push(` <url>\n <loc>${SITE}/video/${xmlEscape(v.slug)}</loc>\n <lastmod>${new Date(v.publishedAt).toISOString()}</lastmod>\n <changefreq>weekly</changefreq>\n <priority>0.8</priority>\n </url>`);
|
||||
}
|
||||
const xml = `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${urls.join("\n")}\n</urlset>`;
|
||||
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 ` <url>\n <loc>${page}</loc>\n <video:video>\n` +
|
||||
` <video:thumbnail_loc>${SITE}${xmlEscape(v.posterUrl)}</video:thumbnail_loc>\n` +
|
||||
` <video:title>${xmlEscape(v.shortTitle)}</video:title>\n` +
|
||||
` <video:description>${xmlEscape((v.teaser || v.shortTitle).slice(0, 1900))}</video:description>\n` +
|
||||
` <video:player_loc>${xmlEscape(v.embedUrl || `https://www.youtube-nocookie.com/embed/${v.ytId}`)}</video:player_loc>\n` +
|
||||
` <video:duration>${v.durationS || 0}</video:duration>\n` +
|
||||
` <video:publication_date>${new Date(v.publishedAt).toISOString()}</video:publication_date>\n` +
|
||||
` <video:family_friendly>yes</video:family_friendly>\n` +
|
||||
` <video:live>no</video:live>\n` +
|
||||
` </video:video>\n </url>`;
|
||||
});
|
||||
const xml = `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">\n${urls.join("\n")}\n</urlset>`;
|
||||
res.type("application/xml").send(xml);
|
||||
} catch (e) {
|
||||
res.status(500).type("application/xml").send('<?xml version="1.0"?><urlset/>');
|
||||
}
|
||||
});
|
||||
|
||||
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");
|
||||
|
||||
+6
-4
@@ -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 = [
|
||||
'<article class="ssr-content">',
|
||||
`<h1>${escapeHtml(v.shortTitle)}</h1>`,
|
||||
`<video controls playsinline preload="metadata" poster="${escapeHtml(v.posterUrl)}" style="max-width:100%;height:auto;" src="${escapeHtml(v.previewUrl)}"></video>`,
|
||||
`<iframe width="640" height="360" src="${escapeHtml(embedUrl)}" title="${escapeHtml(v.shortTitle)}" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="border:0;max-width:100%;"></iframe>`,
|
||||
`<p><strong>${escapeHtml(desc)}</strong></p>`,
|
||||
chapterHtml,
|
||||
`<p><a href="${escapeHtml(v.youtubeUrl)}" rel="noopener">Das ganze Video auf YouTube ansehen</a></p>`,
|
||||
|
||||
Reference in New Issue
Block a user