elixirschool / school_house

The new era of Elixir School now powered by @phoenixframework
https://elixirschool.com/
Apache License 2.0
155 stars 49 forks source link

Duplicate p end tag in excerpts #128

Closed jaimeiniesta closed 3 years ago

jaimeiniesta commented 3 years ago

A recent commit has introduced this HTML issue:

https://rocketvalidator.com/s/6f75c943-9b77-4f5d-a87d-1dfc6094c551/i/113585449

Clicking on the details for a page affected, you can see the lines where this appear on the code, for example:

Captura de pantalla 2021-08-28 a las 10 18 02

@kinson I think this was introduced in your last commit but I can't see where is the </p> being duplicated, any idea?

kinson commented 3 years ago

Good catch by RV! While we obviously don't want unnecessary tags, I am curious why this was reported error:

An end tag </p> has been found that cannot be matched for an opening tag <p>. Most of the times this is due to closing the same tag twice, for example:

Looking at the report (and your example), it appears that there is not a missing <p> tag, just an extra set of <p> tags. Am I misunderstanding the report or the issue?

jaimeiniesta commented 3 years ago

Well it looks like this has been fixed in #129 - I've re-checked the affected pages and the issue is gone!

@kinson I believe the issue was correct, from my screenshot you can see an extra closing </p> tag, like <p class="excerpt">some text</p></p>, right?

jaimeiniesta commented 3 years ago

Ah @kinson now that I see it better, the problem was a nested <p> inside another <p>. If you go to the w3c validator you can check this is incorrect:

<!DOCTYPE html>
<html lang="">
<head>
<title>Test</title>
</head>
<body>
<p><p></p></p>
</body>
</html>
kinson commented 3 years ago

~To me it looks like in the example you posted there is an opening tag on line 519 & 520 and then a closing tag on lines 521 & 523 - so 2 opening tags and 2 corresponding closing tags.~

Ahh just saw your response, that makes sense - thanks for catching this and posting the issue 🚀 !