Comparing version 2.4.11 to 2.5.0
{ | ||
"name": "bse-admin", | ||
"version": "2.4.11", | ||
"version": "2.5.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -18,2 +18,3 @@ var TargetBase = require('./base'), | ||
require('../tasks/override-links'), | ||
require('../tasks/sitemap-xml'), | ||
require('../tasks/finalize') | ||
@@ -20,0 +21,0 @@ ]; |
@@ -16,2 +16,3 @@ var TargetBase = require('./base'), | ||
require('../tasks/override-links'), | ||
require('../tasks/sitemap-xml'), | ||
require('../tasks/finalize') | ||
@@ -18,0 +19,0 @@ ]; |
@@ -23,2 +23,3 @@ var TargetBase = require('./base'), | ||
require('../tasks/override-links'), | ||
require('../tasks/sitemap-xml'), | ||
require('../tasks/finalize') | ||
@@ -25,0 +26,0 @@ ]; |
@@ -16,3 +16,3 @@ var path = require('path'), | ||
require('../tasks/finalize') | ||
].forEach(function (task) { | ||
].forEach(function (task) { | ||
this.addTask(task); | ||
@@ -19,0 +19,0 @@ }, this); |
@@ -11,7 +11,10 @@ var _ = require('lodash'), | ||
logger.info('Start to build "sitemap.xml" file', module); | ||
var hosts = target.getOptions['hosts'] || {}; | ||
var options = target.getOptions(), | ||
hosts = options.hosts || {}, | ||
isDev = options.NODE_ENV === 'development'; | ||
// check if any changes were collected during current synchronization | ||
// otherwise we should skip this task | ||
if (!target.getChanges().areModified()) { | ||
// p.s. always rebuild sitemap in development | ||
if (!isDev && !target.getChanges().areModified()) { | ||
logger.warn('No changes were made during this synchronization. This step will be skipped', module); | ||
@@ -29,12 +32,13 @@ return vow.resolve(target); | ||
// get all nodes from db that have inner urls | ||
return levelDb | ||
.getByCriteria(function (record) { | ||
var key = record.key, | ||
value = record.value; | ||
return levelDb.get().getByCriteria(function (record) { | ||
var key = record.key, | ||
value = record.value; | ||
if (key.indexOf(target.KEY.NODE_PREFIX) < 0) { | ||
return false; | ||
} | ||
return value.hidden && _.isString(value.url) && !/^(https?:)?\/\//.test(value.url); | ||
}, { gte: target.KEY.NODE_PREFIX, lt: target.KEY.PEOPLE_PREFIX, fillCache: true }) | ||
if (key.indexOf(target.KEY.NODE_PREFIX) < 0) { | ||
return false; | ||
} | ||
return value.hidden && _.isString(value.url) && !/^(https?:)?\/\//.test(value.url); | ||
}, { gte: target.KEY.NODE_PREFIX, lt: target.KEY.PEOPLE_PREFIX, fillCache: true }) | ||
.then(function (records) { | ||
@@ -58,4 +62,12 @@ // convert data set to sitemap format | ||
.then(function (records) { | ||
var urls = { | ||
'@': { xmlns: 'http://www.sitemaps.org/schemas/sitemap/0.9' }, | ||
url: records | ||
}; | ||
// convert json model to xml format | ||
return levelDb.get().put('sitemapXml', js2xml('urlset', { url: records })); | ||
return vow.all([ | ||
levelDb.get().put('sitemapJson', JSON.stringify(urls)), | ||
levelDb.get().put('sitemapXml', js2xml('urlset', urls)) | ||
]); | ||
}) | ||
@@ -62,0 +74,0 @@ .then(function () { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
186298
4492