Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialIsaac Asante
4,752 PointsIs the W3 Validator unable to review Google Fonts?
I get an error in the W3 Validator when validating my index.html file, and the validator picks the Google Fonts URL syntax in the header as the cause of the error. It says the Google Fonts URL is not having proper syntax. This is the area of my code:
<link href='http://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic,700italic|Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>
I guess this is not an error?
2 Answers
Ryo Kinjo
Courses Plus Student 4,703 PointsYes and no, this is a question that many people are asking right now, the problem is is that the pipe character " | " is not considered to be a URL safe character apparently. Replace all of the | characters inside the link tag with %7C, this should fix the problem.
Funny thing is, a lot of forums are asking about this problem also, including places such as StackOverflow where I got the answer to this problem.
Isaac Asante
4,752 PointsThanks! I've just clicked the Best Answer for you... I'm good with this now.
Ryo Kinjo
Courses Plus Student 4,703 PointsI'm glad to have helped.
Isaac Asante
4,752 PointsIsaac Asante
4,752 PointsI get it! But replacing | with %7C won't affect the Google Font path, will it? Also, is it necessary to make this little change? Or can I leave it since it's not something that will prevent the site from displaying properly? After all, Google themselves provided this code, so they might not bother the invalidation of that mini character. What do you think?
Ryo Kinjo
Courses Plus Student 4,703 PointsRyo Kinjo
Courses Plus Student 4,703 PointsAs far as I'm concerned, it shouldn't effect the Google Font path as %7C represents |, it also worked for me when I tried it out. Like you said though, this won't stop it from displaying properly when run on a browser. This is indeed a W3 Validator only issue.
Hope that this cleared up a few things and I hope that either Google or the W3 will fix this issue. If you have anything else, feel free to ask. Best of Luck!
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsI would say that you should encode it. As mentioned, it is an unsafe character. I remember someone saying on stackoverflow that google made a bad choice with picking that character to use.