vue-router-sitemap icon indicating copy to clipboard operation
vue-router-sitemap copied to clipboard

Use with VUE serverless app

Open VincentMRA opened this issue 6 years ago • 4 comments

Hi,

Can this plugin be used on a vue serverless app? If so how can i call the generating function?

Cheers,

VincentMRA avatar Oct 08 '18 02:10 VincentMRA

@VincentMRA not at the moment, this script is generating sitemap.xml, how is is possible client side?

40818419 avatar Oct 22 '18 13:10 40818419

@VincentMRA do you have any examples ?

40818419 avatar Oct 22 '18 13:10 40818419

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 avatar Jun 29 '19 15:06 JimmyBastos

@JimmyBastos

THANKS! It's acturlly useful. I get my own sitemap.xml which bother me two days.

icecranberry avatar May 14 '20 02:05 icecranberry