UNPKG

apostrophe-site-map

Version:

Generate site maps for sites powered by the Apostrophe CMS.

26 lines (24 loc) 881 B
const _ = require('@sailshq/lodash'); const field = require('../../../siteMapPriorityField.js'); const arrange = require('../../../arrangeFields.js'); module.exports = { improve: 'apostrophe-custom-pages', beforeConstruct: function(self, options) { if (options.sitemap !== false && self.__meta.name !== 'trash-auto-pages') { options.addFields = [ _.clone(field) ].concat(options.addFields || []); options.arrangeFields = [ _.clone(arrange) ].concat(options.arrangeFields || []); } }, afterConstruct: function(self) { self.on('apostrophe:modulesReady', 'adjustSchemaForSiteMapPriority', function() { const siteMap = self.apos.modules['apostrophe-site-map']; if (siteMap.options.noPriority === true) { self.schema = self.schema.filter(item => item.name !== 'siteMapPriority'); } }); } };