Skip to content
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

Generated HTML5 fails validation. #618

Closed
drguildo opened this issue Aug 28, 2013 · 9 comments
Closed

Generated HTML5 fails validation. #618

drguildo opened this issue Aug 28, 2013 · 9 comments

Comments

@drguildo
Copy link

By default DocPad seeems to insert the following header into generated HTML:

<meta http-equiv=\"X-Powered-By\" content=\"DocPad v" + docpad.version + "\"/>

which causes it to fail validation using the W3C Validation Service. This is even the case using the HTML5 skeleton.

@greduan
Copy link
Contributor

greduan commented Aug 28, 2013

It shouldn't generate that... It should generate something like this:

<meta http-equiv="X-Powered-By" content="DocPad v6.50.0">

@drguildo
Copy link
Author

Yeah, that's kinda what I was getting at. That is the final output and it is invalid HTML5 according to the W3C validator.

@balupton
Copy link
Member

That's really strange, that's the first time I've seen it output that.

Are you able to provide us with a link to your project source code? If not, could you zip it up and email it to support@docpad.org and I'll take a look. Cheers!

@drguildo
Copy link
Author

I think there are crossed wires. It outputs what Greduan said, I was just quoting the code itself.

node_modules/docpad/out/lib/docpad.js:      meta.add("<meta http-equiv=\"X-Powered-By\" content=\"DocPad v" + docpad.version + "\"/>");

Anyway, my point is that the validator rejects it.

@balupton
Copy link
Member

Hrmm, that source line of code works as expected, and should output <meta http-equiv="X-Powered-By" content="DocPad v6.50.0"> correctly, this is because the backslashes are necessary to keep the string going due to the string being wrapped in double quotes so we must "escape" the double quotes used in the string. For instance:

console.log("Hello "Ben" how are you today?");
// will fail as the string will be seen as "Hello ", then the literal Ben, then the string " how are you today?")
console.log("Hello \"Ben\" how are you today?");
// will work, as the escapes allow us to continue the string, outputting: Hello "Ben" How are you today?

@drguildo
Copy link
Author

Third time lucky: it does output what it is supposed to. My point is that it that

<meta http-equiv="X-Powered-By" content="DocPad v6.50.0">

is not valid HTML and the W3C validator complains about it.

@balupton
Copy link
Member

Can confirm. Looking into it now:

image

@balupton
Copy link
Member

Should be <meta name="generator" content="DocPad v6.50.0" /> instead it seems (that format is what wikipedia uses). Will fix now.

balupton added a commit that referenced this issue Aug 28, 2013
- v6.50.1 August 28, 2013
	- Fixed validation of DocPad sites containing the powered by header
		- Thanks to [drguildo](https://github.com/drguildo) and [Eduan
Lavaque](https://github.com/Greduan) for [issue
#618](#618)
@balupton
Copy link
Member

Fixed with the just released v6.50.1. Awesome work. Thanks for reporting!

balupton added a commit that referenced this issue Oct 23, 2013
- v6.50.1 August 28, 2013
	- Fixed validation of DocPad sites containing the powered by header
		- Thanks to [drguildo](https://github.com/drguildo) and [Eduan
Lavaque](https://github.com/Greduan) for [issue
#618](#618)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants