vue-router-sitemap
vue-router-sitemap copied to clipboard
Use with VUE serverless app
Hi,
Can this plugin be used on a vue serverless app? If so how can i call the generating function?
Cheers,
@VincentMRA not at the moment, this script is generating sitemap.xml, how is is possible client side?
@VincentMRA do you have any examples ?
I suggest you to give a look at Sitemap Webpack Plugin for static sitemap generation
//router.paths.js
/**
* @type {import('vue-router').RouteConfig[]}
*/
var paths = [
{
path: '/',
name: 'Home'
},
{
path: '/about',
name: 'About'
},
{
path: '*',
name: '404'
}
]
module.exports = { default: paths } // ES6 Module Interoperability
// vue.config.js
const SitemapPlugin = require('sitemap-webpack-plugin').default
const routerPaths = require('./src/router.paths').default.map(r => r.path).filter(p => !p.match(/\*/))
module.exports = {
configureWebpack: {
plugins: [
new SitemapPlugin('https://www.website.com.br', routerPaths, {
fileName: 'sitemap.xml',
lastMod: true,
changeFreq: 'monthly'
})
]
}
}
@JimmyBastos
THANKS! It's acturlly useful. I get my own sitemap.xml which bother me two days.