passmarked / seo

Rules related to checking for any SEO issues on the page given
https://passmarked.com/library/seo
Apache License 2.0
11 stars 11 forks source link

`title.multiple` shouldn't be triggered for <title> inside <svg> #22

Open gareth opened 6 years ago

gareth commented 6 years ago

SVG elements are allowed to have <title> elements contained within them, and this shouldn't be considered an SEO violation when embedded into an HTML page.

https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title

Johanndutoit commented 6 years ago

You are 100% correct, didn't think of that. See it's just looking for all titles in the HTML which is not right at https://github.com/passmarked/seo/blob/develop/lib/rules/title.js#L77.

Easy fix is probably to just check the head or just check if the parent, thoughts? Would be interested in beefing this up a bit more if you know of any more scenarios?

gnclmorais commented 6 years ago

MDN says:

Permitted parents<head> element that contains no other <title> element.

So checking if it’s inside a <head> element and is unique is enough?

Johanndutoit commented 6 years ago

@gnclmorais yes think you are on the money, will update to just look under <head>. Expect a PR in a few.

gareth commented 6 years ago

I guess this will also affect title.location too, thinking about it

Johanndutoit commented 6 years ago

Thanks for the report, catching up on my workload now only. See https://github.com/passmarked/seo/pull/23 for the PR, will merge once tests pass