Added sitemap
This commit is contained in:
parent
c3bc4e604a
commit
346016b5c4
7 changed files with 78 additions and 1 deletions
|
|
@ -61,3 +61,4 @@ reywood:publish-composite
|
||||||
barbatus:stars-rating
|
barbatus:stars-rating
|
||||||
arkham:comments-ui
|
arkham:comments-ui
|
||||||
facts
|
facts
|
||||||
|
gadicohen:sitemaps
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ flowkey:raven@1.0.0
|
||||||
fortawesome:fontawesome@4.7.0
|
fortawesome:fontawesome@4.7.0
|
||||||
fourseven:scss@4.5.4
|
fourseven:scss@4.5.4
|
||||||
gadicc:blaze-react-component@1.4.0
|
gadicc:blaze-react-component@1.4.0
|
||||||
|
gadicohen:robots-txt@0.0.10
|
||||||
|
gadicohen:sitemaps@0.0.26
|
||||||
geojson-utils@1.0.10
|
geojson-utils@1.0.10
|
||||||
github-oauth@1.2.0
|
github-oauth@1.2.0
|
||||||
google-oauth@1.2.4
|
google-oauth@1.2.4
|
||||||
|
|
|
||||||
14
cucumber/features/general.feature
Normal file
14
cucumber/features/general.feature
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
Feature: This app should generate a correct sitemap, etc
|
||||||
|
|
||||||
|
@watch
|
||||||
|
Scenario: I verify that a sitemap is generated correctly
|
||||||
|
Given the page sitemap.xml
|
||||||
|
Then I check that exist this list of pages in the sitemap
|
||||||
|
| license | License |
|
||||||
|
| terms | Terms of Service |
|
||||||
|
| credits | Credits |
|
||||||
|
| privacy | Privacy Policy |
|
||||||
|
| fires | Active Fires |
|
||||||
|
| login | Login |
|
||||||
|
| signup | Signup |
|
||||||
|
# And should be spiderables
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
@watch
|
|
||||||
Feature: Test all secundary pages
|
Feature: Test all secundary pages
|
||||||
|
|
||||||
Scenario: Check that all secondary pages work well
|
Scenario: Check that all secondary pages work well
|
||||||
|
|
|
||||||
20
cucumber/features/steps_definitions/general.js
Normal file
20
cucumber/features/steps_definitions/general.js
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* global module expect require process client */
|
||||||
|
|
||||||
|
module.exports = function doSteps() {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
this.Then(/^I check that exist this list of pages in the sitemap$/, (table, callback) => {
|
||||||
|
// Write code here that turns the phrase above into concrete actions
|
||||||
|
pages = table.raw();
|
||||||
|
for (let i = 0; i < pages.length; i += 1) {
|
||||||
|
// TODO download sitemap and parse
|
||||||
|
// client.waitForText('.text', pages[i][0]);
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.Given(/^the page sitemap\.xml$/, (callback) => {
|
||||||
|
client.url(`${process.env.ROOT_URL}/sitemap.xml`);
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
@ -8,3 +8,4 @@ import './migrations';
|
||||||
import './notificationsObserver';
|
import './notificationsObserver';
|
||||||
import './facts';
|
import './facts';
|
||||||
import '../common/comments';
|
import '../common/comments';
|
||||||
|
import './sitemaps';
|
||||||
|
|
|
||||||
40
imports/startup/server/sitemaps.js
Normal file
40
imports/startup/server/sitemaps.js
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
/* global sitemaps Comments */
|
||||||
|
/* eslint-disable import/no-absolute-path */
|
||||||
|
|
||||||
|
import Fires from '/imports/api/Fires/Fires';
|
||||||
|
// import Comments from '/imports/api/Comments/Comments';
|
||||||
|
|
||||||
|
sitemaps.add('/sitemap.xml', () => {
|
||||||
|
const today = new Date();
|
||||||
|
|
||||||
|
const out = [];
|
||||||
|
out.push({ page: '/fires', lastmod: today });
|
||||||
|
out.push({ page: '/login', lastmod: today });
|
||||||
|
out.push({ page: '/signup', lastmod: today });
|
||||||
|
out.push({ page: '/recover-password', lastmod: today });
|
||||||
|
out.push({ page: '/credits', lastmod: today });
|
||||||
|
out.push({ page: '/terms', lastmod: today });
|
||||||
|
out.push({ page: '/license', lastmod: today });
|
||||||
|
out.push({ page: '/privacy', lastmod: today });
|
||||||
|
|
||||||
|
|
||||||
|
// When user has public page
|
||||||
|
/* const users = Meteor.users.find().fetch();
|
||||||
|
_.each(users, function(user) {
|
||||||
|
out.push({
|
||||||
|
page: '/persona/' + user.username,
|
||||||
|
lastmod: user.updatedAt
|
||||||
|
});
|
||||||
|
}); */
|
||||||
|
|
||||||
|
Fires.find().fetch().forEach((fire) => {
|
||||||
|
// Search the last comment of tha fire
|
||||||
|
const lastComment = Comments.getCollection().findOne({ referenceId: `fire-${fire._id}` }, { sort: { createdAt: -1 } });
|
||||||
|
out.push({
|
||||||
|
page: `/fire/archive/${fire._id._str}`,
|
||||||
|
lastmod: lastComment ? lastComment.createdAt : fire.updatedAt
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return out;
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue