Adding Video Metadata to Your Sitemap in Next.js
Unanswered
Cuban Crocodile posted this in #help-forum
Cuban CrocodileOP
I was trying to index a video on my website by adding it to my sitemap.ts, but it didn’t appear in the sitemap as expected. Here's what I did and the XML output I got.
export default function sitemap() {
const currentDate = new Date();
const sitemapEntries: any = [];
const entry = {
url:
lastModified: currentDate,
changeFrequency: "daily",
priority: 1,
video: [{
loc: 'https://nwekar-bucket.s3.eu-north-1.amazonaws.com/Render%20V6.mp4',
title: 'Scope of Work - Alshaybaa',
description: 'An overview of the scope of work at Alshaybaa, covering our services and expertise.',
thumbnail_loc: 'https://your-thumbnail-image-url.com/thumbnail.jpg', // Replace with your thumbnail URL
lastmod: currentDate.toISOString(),
duration: 120, // Duration in seconds
content_loc: 'https://nwekar-bucket.s3.eu-north-1.amazonaws.com/Render%20V6.mp4',
player_loc: 'https://www.alshaybaa.com/en/SERVICES',
}],
};
sitemapEntries.push(entry);
return sitemapEntries;
}
My XML Output:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<script/>
<url>
<loc>https://www.alshaybaa.com/en/SERVICES</loc>
<lastmod>2024-08-17T13:51:49.669Z</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
</urlset>
export default function sitemap() {
const currentDate = new Date();
const sitemapEntries: any = [];
const entry = {
url:
https://www.alshaybaa.com/en/SERVICES,lastModified: currentDate,
changeFrequency: "daily",
priority: 1,
video: [{
loc: 'https://nwekar-bucket.s3.eu-north-1.amazonaws.com/Render%20V6.mp4',
title: 'Scope of Work - Alshaybaa',
description: 'An overview of the scope of work at Alshaybaa, covering our services and expertise.',
thumbnail_loc: 'https://your-thumbnail-image-url.com/thumbnail.jpg', // Replace with your thumbnail URL
lastmod: currentDate.toISOString(),
duration: 120, // Duration in seconds
content_loc: 'https://nwekar-bucket.s3.eu-north-1.amazonaws.com/Render%20V6.mp4',
player_loc: 'https://www.alshaybaa.com/en/SERVICES',
}],
};
sitemapEntries.push(entry);
return sitemapEntries;
}
My XML Output:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<script/>
<url>
<loc>https://www.alshaybaa.com/en/SERVICES</loc>
<lastmod>2024-08-17T13:51:49.669Z</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
</urlset>