diff --git a/controllers/resources.js b/controllers/resources.js index f4db69018f..8ec410f9dc 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -52,7 +52,7 @@ module.exports = { debug('User err: ', err); return next(err); } - Challenge.find({}, function (err, challenges) { + Courseware.find({}, function (err, challenges) { if (err) { debug('User err: ', err); return next(err); @@ -67,14 +67,28 @@ module.exports = { debug('User err: ', err); return next(err); } - res.header('Content-Type', 'application/xml'); - res.render('resources/sitemap', { - appUrl: appUrl, - now: now, - users: users, - challenges: challenges, - bonfires: bonfires, - stories: stories + Nonprofit.find({}, function (err, nonprofits) { + if (err) { + debug('User err: ', err); + return next(err); + } + FieldGuide.find({}, function (err, fieldGuides) { + if (err) { + debug('User err: ', err); + return next(err); + } + res.header('Content-Type', 'application/xml'); + res.render('resources/sitemap', { + appUrl: appUrl, + now: now, + users: users, + challenges: challenges, + bonfires: bonfires, + stories: stories, + nonprofits: nonprofits, + fieldGuides: fieldGuides + }); + }); }); }); }); diff --git a/views/resources/sitemap.jade b/views/resources/sitemap.jade index c51b2a3c99..d2b4298424 100644 --- a/views/resources/sitemap.jade +++ b/views/resources/sitemap.jade @@ -105,7 +105,7 @@ urlset(xmlns="http://www.sitemaps.org/schemas/sitemap/0.9") //- Products each bonfire in bonfires url - loc #{appUrl}/#{bonfire.name.replace(/\s/, '-')} + loc #{appUrl}/bonfires/#{bonfire.name.replace(/\s/, '-')} lastmod= now changefreq weekly priority= 0.5 @@ -113,7 +113,7 @@ urlset(xmlns="http://www.sitemaps.org/schemas/sitemap/0.9") //- Challenges each challenge in challenges url - loc #{appUrl}/#{challenge.challengeNumber} + loc #{appUrl}/challenges/#{challenge.name.replace(/\s/, '-')} lastmod= now changefreq weekly priority= 0.5 @@ -121,15 +121,23 @@ urlset(xmlns="http://www.sitemaps.org/schemas/sitemap/0.9") //- Stories each story in stories url - loc #{appUrl}/#{story.storyLink} + loc #{appUrl}/stories/#{story.storyLink.name.replace(/\s/, '-')} lastmod= now changefreq daily priority= 0.9 -//- Nonprofit + //- Nonprofit each nonprofit in nonprofits url - loc #{appUrl}/#{nonprofit.nonprofitLink} - lastmod= now - changefreq daily - priority= 0.9 \ No newline at end of file + loc #{appUrl}/nonprofits/#{nonprofit.name.replace(/\s/, '-')} + lastmod= now + changefreq daily + priority= 0.9 + + //- Nonprofit + each fieldGuide in fieldGuides + url + loc #{appUrl}/field-guide/#{fieldGuide.name.replace(/\s/, '-')} + lastmod= now + changefreq daily + priority= 0.9