diff --git a/nuxt.config.js b/nuxt.config.js index 3f9a0afb..2ec3f807 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -51,8 +51,27 @@ module.exports = { // Doc: https://axios.nuxtjs.org/usage '@nuxtjs/axios', '@nuxtjs/auth', + '@nuxtjs/sitemap' ], + sitemap: { + hostname: config.baseurl, + gzip: true, + exclude: [ + '/Admin', + '/settings', + '/export', + '/setup' + ], + routes: async () => { + if (config.status === 'READY') { + const Event = require('./server/api/models/event') + const events = await Event.findAll({where: { is_visible: true }}) + return events.map(e => `/event/${e.slug}`) + } + } + }, + serverMiddleware: ['server/routes'], /* diff --git a/package.json b/package.json index d16a4ccf..8347e371 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@mdi/js": "^6.6.96", "@nuxtjs/auth": "^4.9.1", "@nuxtjs/axios": "^5.13.5", + "@nuxtjs/sitemap": "^2.4.0", "accept-language": "^3.0.18", "axios": "^0.27.2", "bcryptjs": "^2.4.3",