-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sitemap Check / Validation #10
Conversation
…ut for now this covers the basic structure
See node v0.12 requires some work as |
…usted end of the year anyway
Upped the version required to v0.12, it's not worth supporting v0.12 as it's dropping of end of the year anyway |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nitpicking grammar issues
|
||
]; | ||
|
||
// get the robots from site |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referencing robots and not sitemap
if(err) { | ||
|
||
// output to log | ||
payload.error('Problem checking the robots txt', err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referencing robots and not sitemap
// add the occurence | ||
payload.addRule(rulePrologMeta, { | ||
|
||
message: 'Sitemap prolog have $ as a closing tag', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have must be has
// add the rule | ||
payload.addRule(ruleSchemaMeta, { | ||
|
||
message: 'The root node of the site ($) should contain only $ nodes', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sitemap
describe('sitemap', function() { | ||
|
||
// add the test for the robot | ||
it('Should not return a error if the /sitemap.xml url returned anything else than a 200', function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an error
|
||
// check for a error | ||
if(err) | ||
assert.fail('Was not expecting a error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an error
|
||
// check if we found it | ||
if(!rule) | ||
assert.fail('Was expecting a rule to return'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an error
}); | ||
|
||
// add the test for the robot | ||
it('Should not return a error if the sitemap returned as application/xml', function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an error
|
||
// check for a error | ||
if(err) | ||
assert.fail('Was not expecting a error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an error
}); | ||
|
||
// add the test for the robot | ||
it('Should not return a error if the sitemap returned as text/xml', function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and so for all of them...
@BarryBotha ^ grammar fixes as requested (oops) |
Merging :) |
Does a check for the sitemap as well as validation if present. We're not too worried about sitemaps but if one is defined it should be in the right format, and if none are present the url /sitemap.xml should not return a catchall page that renders the homepage or something.
Consider this the first version, it currently checks:
text/xml
orapplication/text
which should stop any HTML pages throughGoing to see about adding actual value validation for each of the properties as they all have their own specs for how the data should be presented