diff --git a/nuxt.config.js b/nuxt.config.js index 4624f3b..e9ce42a 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,3 +1,4 @@ +const axios = require('axios') const env = require('./env'); const webpack = require('webpack') @@ -73,10 +74,44 @@ export default { 'cookie-universal-nuxt', 'nuxt-sass-resources-loader', 'bootstrap-vue/nuxt', + '@nuxtjs/sitemap' ], bootstrapVue: { icons: false }, + sitemap: { + hostname: 'http://122.51.230.86:8099', + sitemaps: [ + { + path: '/sitemap.xml', + routes: [ + '/pages.xml', + '/products.xml', + '/inquiry.xml', + '/article-page.xml', + ], + gzip: true + }, + { + path: '/pages.xml', + routes: ['/'], + }, + { + path: '/products.xml', + routes: async () => { + const { data: res} = await axios.get('http://122.51.230.86:8099/web/prodPageList?pageNum=1&pageSize=9&catgId=43bb1e22091c0f674453c8db7e89b4a3&tenantId=main') + return res.data.records.map(item => { + return { + url: `/products/${item.id}`, + changefreq: 'daily', + priority: 1 + } + }) + }, + gzip: true + } + ] + }, router: { middleware: ['i18n', 'footer', 'header'] }, diff --git a/package-lock.json b/package-lock.json index 9ac107d..18f22b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2196,6 +2196,52 @@ "http-proxy-middleware": "^1.0.6" } }, + "@nuxtjs/sitemap": { + "version": "2.4.0", + "resolved": "https://registry.npmmirror.com/@nuxtjs/sitemap/-/sitemap-2.4.0.tgz", + "integrity": "sha512-TVgIYOtPp7KAfaUo76WRpGbO20j4D/xi/A7shFIGjARHs+FvfAWXNCtBT87dTwe/RoYzAsEKtijFFUTaSu5bUA==", + "requires": { + "async-cache": "^1.1.0", + "consola": "^2.13.0", + "etag": "^1.8.1", + "fresh": "^0.5.2", + "fs-extra": "^8.1.0", + "is-https": "^2.0.2", + "lodash.unionby": "^4.8.0", + "minimatch": "^3.0.4", + "sitemap": "^4.1.1" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "is-https": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/is-https/-/is-https-2.0.2.tgz", + "integrity": "sha512-UfUCKVQH/6PQRCh5Qk9vNu4feLZiFmV/gr8DjbtJD0IrCRIDTA6E+d/AVFGPulI5tqK5W45fYbn1Nir1O99rFw==" + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmmirror.com/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + } + } + }, "@nuxtjs/style-resources": { "version": "1.2.2", "resolved": "https://registry.npmmirror.com/@nuxtjs/style-resources/-/style-resources-1.2.2.tgz", @@ -2291,6 +2337,14 @@ "resolved": "https://registry.npmmirror.com/@types/q/-/q-1.5.8.tgz", "integrity": "sha512-hroOstUScF6zhIi+5+x0dzqrHA1EJi+Irri6b1fxolMTqqHIV/Cg77EtnQcZqZCu8hR3mX2BzIxN4/GzI68Kfw==" }, + "@types/sax": { + "version": "1.2.7", + "resolved": "https://registry.npmmirror.com/@types/sax/-/sax-1.2.7.tgz", + "integrity": "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==", + "requires": { + "@types/node": "*" + } + }, "@types/source-list-map": { "version": "0.1.6", "resolved": "https://registry.npmmirror.com/@types/source-list-map/-/source-list-map-0.1.6.tgz", @@ -2887,6 +2941,30 @@ "lodash": "^4.17.14" } }, + "async-cache": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/async-cache/-/async-cache-1.1.0.tgz", + "integrity": "sha512-YDQc4vBn5NFhY6g6HhVshyi3Fy9+SQ5ePnE7JLDJn1DoL+i7ER+vMwtTNOYk9leZkYMnOwpBCWqyLDPw8Aig8g==", + "requires": { + "lru-cache": "^4.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" + } + } + }, "async-each": { "version": "1.0.6", "resolved": "https://registry.npmmirror.com/async-each/-/async-each-1.0.6.tgz", @@ -6809,6 +6887,11 @@ "lodash._reinterpolate": "^3.0.0" } }, + "lodash.unionby": { + "version": "4.8.0", + "resolved": "https://registry.npmmirror.com/lodash.unionby/-/lodash.unionby-4.8.0.tgz", + "integrity": "sha512-e60kn4GJIunNkw6v9MxRnUuLYI/Tyuanch7ozoCtk/1irJTYBj+qNTxr5B3qVflmJhwStJBv387Cb+9VOfABMg==" + }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmmirror.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -10847,6 +10930,30 @@ "totalist": "^3.0.0" } }, + "sitemap": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/sitemap/-/sitemap-4.1.1.tgz", + "integrity": "sha512-+8yd66IxyIFEMFkFpVoPuoPwBvdiL7Ap/HS5YD7igqO4phkyTPFIprCAE9NMHehAY5ZGN3MkAze4lDrOAX3sVQ==", + "requires": { + "@types/node": "^12.0.2", + "@types/sax": "^1.2.0", + "arg": "^4.1.1", + "sax": "^1.2.4", + "xmlbuilder": "^13.0.0" + }, + "dependencies": { + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmmirror.com/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + } + } + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/slash/-/slash-3.0.0.tgz", @@ -13001,6 +13108,11 @@ "resolved": "https://registry.npmmirror.com/ws/-/ws-7.5.10.tgz", "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==" }, + "xmlbuilder": { + "version": "13.0.2", + "resolved": "https://registry.npmmirror.com/xmlbuilder/-/xmlbuilder-13.0.2.tgz", + "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==" + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 2faa98b..7844352 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@chenfengyuan/vue-countdown": "^1.1.5", "@nuxtjs/axios": "^5.12.2", "@nuxtjs/i18n": "^7.3.1", + "@nuxtjs/sitemap": "^2.4.0", "bootstrap-vue": "^2.23.1", "cookie-universal-nuxt": "^2.1.4", "core-js": "^3.43.0",