Right now the sitemap module can only add entries for pages that are generated with Gridsome. It would be great to have an option to add static URLs like images and videos.
Example from the sitemap.js docs
url: 'http://test.com/page-1/',
img: [
{
url: 'http://test.com/img1.jpg',
caption: 'An image',
title: 'The Title of Image One',
geoLocation: 'London, United Kingdom',
license: 'https://creativecommons.org/licenses/by/4.0/'
},
{
url: 'http://test.com/img2.jpg',
caption: 'Another image',
title: 'The Title of Image Two',
geoLocation: 'London, United Kingdom',
license: 'https://creativecommons.org/licenses/by/4.0/'
}
]
}]
A way to handle this would be to add a staticUrls property in the config of the stitemap modulde:
plugins: [
{
use: '@gridsome/plugin-sitemap',
options: {
config: {
staticUrls: [
{
url: '/images/',
img: [
{
url: '/images/img1.jpg',
caption: 'An image',
title: 'The Title of Image One',
geoLocation: 'London, United Kingdom',
}
]
}
]
}
}
}
]
Sometimes you need to add static URLs to the sitemap for SEO.
Edit:
Maybe a options.staticUrls is better?
plugins: [
{
use: '@gridsome/plugin-sitemap',
options: {
staticUrls: [
{
url: '/images/',
img: [
{
url: '/images/img1.jpg',
caption: 'An image',
title: 'The Title of Image One',
geoLocation: 'London, United Kingdom',
}
]
}
],
config: {
// rest of config here
}
}
}
]
Just so you know your work here is appreciated, I merged your pull request on my fork, got it available via verdaccio, and started to try it out via a build.
Unfortunately something about the current state of master scrambled the router or its connection to vuetify menus, so had to put it back as must advance the underlying project. Afterwards I mused on what I might have forgotten, such as pulling also state of other plugins from the fork...probably just something like that. But an interesting expedition, and looking forward to the static urls for sure in a release! In my case, I'd like to put some vuepress doc under one.
Thanks a lot for the request and commits! :tada: :smile: @ameistad if you're finished, or ready for feedback, could you please make a PR out of this?
PR was merged (#392).
Most helpful comment
Thanks a lot for the request and commits! :tada: :smile: @ameistad if you're finished, or ready for feedback, could you please make a PR out of this?