Video Sitemap XML

Hi all,

I have been using the [[!StercSeoSiteMap]] snippet to create sitemaps within all my sites and it works very well - thanks Sterc!

But - a customer has just asked me to create a video sitemap to help index all the video content on the site.
The videos on the site are distributed around various galleries.
All videos are embedded directly from youTube.

I can obviously create a manual sitemap, but this is A: time consuming, and B: will easily become out of sync if videos are changed/moved.

I just wondered how you guys handle video sitemaps within MODX?
Do you use an extra for it (I can’t find anything so far) or does it need to be hand-rolled?

Thanks in advance for any tips!
Andy

1 Like

I just thought, maybe i could build the sitemap using a getResources call based on the TV that I use for the youtube code?

1 Like

Ooh, now you are thinking!

So this is what i have done in case anyone is interested!

I have a new resource which is an xml file.
It has an empty template, but within the content field (not richtext) I have:

<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="https://www.google.com/schemas/sitemap-video/1.1">
[[!pdoResources?
&parents=`0`
&depth=`10`
&includeTVs=`galleryVideo`
&tpl=`videoSitemapTpl`
&tvFilters=`galleryVideo!==""`
&limit=`1000`
]]
</urlset>

So this looks for all resources which have the TV galleryVideo completed.

Then the TPL is this:

<url>
<loc>[[++site_url]][[~[[+id]]]]</loc>
<changefreq>never</changefreq>
<priority>1.0</priority>
<video:video>
<video:player_loc allow_embed="yes">
https://www.youtube.com/v/[[+tv.galleryVideo]]?fs=1&amp;hl=en_US&amp;rel=0&amp;hd=1&amp;autoplay=1
</video:player_loc
<video:thumbnail_loc>https://img.youtube.com/vi/[[+tv.galleryVideo]]/default.jpg</video:thumbnail_loc>
<video:title>[[+pagetitle]]</video:title>
<video:description>[[+longtitle]]</video:description>
<video:tag/>
<video:tag>West Lodge Park</video:tag>
<video:tag>Country House Hotel</video:tag>
<video:category>People &amp; Blogs</video:category>
</video:video>
</url>

This creates a sitemap.xml with JUST resources that contain a youtube video. The only thing I’m not 100% sure about is that the syntax for the sitemap is correct - but I think it is?

1 Like

Had confirmation from an SEO expert that the syntax I have used for the video sitemap is correct, so we’re good to go. I’ll leave this all here in case others have the same question - it was a simple solution in the end!

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.