Skip to content

Commit

Permalink
Website: Update policies and vitals page URLs in download-sitemap (#…
Browse files Browse the repository at this point in the history
…25719)

Related to: #25718

Changes:
- Updated `download-sitemap.js` to add the correct URLS of vitals and
policies pages.
  • Loading branch information
eashaw authored Jan 23, 2025
1 parent e81f0f8 commit 7fd9d8a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion website/api/controllers/download-sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module.exports = {
throw {badConfig: 'builtStaticContent.queries'};
} else if (!_.isArray(sails.config.builtStaticContent.markdownPages)) {
throw {badConfig: 'builtStaticContent.markdownPages'};
} else if (!_.isArray(sails.config.builtStaticContent.policies)) {
throw {badConfig: 'builtStaticContent.policies'};
}

// Start with sitemap.xml preamble + the root relative URLs of other webpages that aren't being generated from markdown
Expand Down Expand Up @@ -79,9 +81,18 @@ module.exports = {
// ╔╦╗╦ ╦╔╗╔╔═╗╔╦╗╦╔═╗ ╔═╗╔═╗╦═╗ ╔═╗ ╦ ╦╔═╗╦═╗╦ ╦ ╔═╗╔═╗╔═╗╔═╗╔═╗
// ║║╚╦╝║║║╠═╣║║║║║ ╠═╝║╣ ╠╦╝───║═╬╗║ ║║╣ ╠╦╝╚╦╝ ╠═╝╠═╣║ ╦║╣ ╚═╗
// ═╩╝ ╩ ╝╚╝╩ ╩╩ ╩╩╚═╝ ╩ ╚═╝╩╚═ ╚═╝╚╚═╝╚═╝╩╚═ ╩ ╩ ╩ ╩╚═╝╚═╝╚═╝
for (let query of sails.config.builtStaticContent.queries) {
let vitals = _.where(sails.config.builtStaticContent.queries, {kind: 'built-in'});
let queries = _.where(sails.config.builtStaticContent.queries, {kind: 'query'});
let policies = _.where(sails.config.builtStaticContent.policies, {kind: 'policy'});
for (let query of queries) {
sitemapXml +=`<url><loc>${_.escape(sails.config.custom.baseUrl+`/queries/${query.slug}`)}</loc></url>`;// note we omit lastmod for some sitemap entries. This is ok, to mix w/ other entries that do have lastmod. Why? See https://docs.google.com/document/d/1SbpSlyZVXWXVA_xRTaYbgs3750jn252oXyMFLEQxMeU/edit
}//∞
for (let query of vitals) {
sitemapXml +=`<url><loc>${_.escape(sails.config.custom.baseUrl+`/vitals/${query.slug}`)}</loc></url>`;// note we omit lastmod for some sitemap entries. This is ok, to mix w/ other entries that do have lastmod. Why? See https://docs.google.com/document/d/1SbpSlyZVXWXVA_xRTaYbgs3750jn252oXyMFLEQxMeU/edit
}//∞
for (let query of policies) {
sitemapXml +=`<url><loc>${_.escape(sails.config.custom.baseUrl+`/policies/${query.slug}`)}</loc></url>`;// note we omit lastmod for some sitemap entries. This is ok, to mix w/ other entries that do have lastmod. Why? See https://docs.google.com/document/d/1SbpSlyZVXWXVA_xRTaYbgs3750jn252oXyMFLEQxMeU/edit
}//∞
// ╔╦╗╦ ╦╔╗╔╔═╗╔╦╗╦╔═╗ ╔═╗╔═╗╔═╗╔═╗╔═╗ ╔═╗╦═╗╔═╗╔╦╗ ╔╦╗╔═╗╦═╗╦╔═╔╦╗╔═╗╦ ╦╔╗╔
// ║║╚╦╝║║║╠═╣║║║║║ ╠═╝╠═╣║ ╦║╣ ╚═╗ ╠╣ ╠╦╝║ ║║║║ ║║║╠═╣╠╦╝╠╩╗ ║║║ ║║║║║║║
// ═╩╝ ╩ ╝╚╝╩ ╩╩ ╩╩╚═╝ ╩ ╩ ╩╚═╝╚═╝╚═╝ ╚ ╩╚═╚═╝╩ ╩ ╩ ╩╩ ╩╩╚═╩ ╩═╩╝╚═╝╚╩╝╝╚╝
Expand Down

0 comments on commit 7fd9d8a

Please sign in to comment.