robogeek / wp-nofollow

External links rel=nofollow, favicon, fixer-upper
GNU General Public License v2.0
0 stars 0 forks source link

plugin add duplicate html and body tags #21

Closed shubhendusaurabh closed 7 years ago

shubhendusaurabh commented 7 years ago

I am using this plugin for my website but it adds its own html and body tags. Then it fails w3 validation.

robogeek commented 7 years ago

Can you provide an example page? I just checked a page on my site where there were favicons inserted by the plugin, and the W3C Validator doesn't say anything like what you suggest. It has some other problems with other elements of the site, but not this.

https://validator.w3.org/nu/?doc=https%3A%2F%2Flongtailpipe.com%2F2017%2F05%2F22%2Fdemonstrating-value-of-thrown-away-electronics-with-an-diy-electric-vehicle%2F

My site is running WP4.7.x with the Nirvana theme

shubhendusaurabh commented 7 years ago

Please check the source of this page. https://www.satellitester.com/uncategorized/best-satellite-phones-for-europe/

you'll notice that there are redundant html and body tags inserted by the plugin. https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.satellitester.com%2Funcategorized%2Fbest-satellite-phones-for-europe%2F

robogeek commented 7 years ago

I've looked carefully at your webpage.

The inserted html tag appears here:

<h1>Best Satellite Phones for Europe</h1>
<p>Posted in <a href="https://www.satellitester.com/category/uncategorized/" rel="category tag">Uncategorized</a> on May 2, 2017<br/>
</p>
<p><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body><p>Having a disposable or satellite phone while in Europe will save you a ton of cash. No matter what, using a regular cell phone in Europe will bring on a very lar
ge bill. Therefore, satellite phones for Europe are the definite answer here.</p>

This is nowhere near any place this plugin makes any changes. This plugin only inserts things next to links or modifies the rel= attribute of tags.

If you disable this plugin, what happens?

shubhendusaurabh commented 7 years ago

I can confirm that it's due to this plugin. Disabled the plugin, for now, you can check again. Redundant tags are no longer present.

robogeek commented 7 years ago

Hurm... reviewing the plugin source, I see it has this text when loading the HTML

<meta http-equiv="content-type" content="text/html; charset=utf-8">

Which is part of the inserted HTML. I don't remember why I did this. Unfortunately that tag would make it into the rendered HTML, it looks like. Curious.

robogeek commented 7 years ago

I've pushed an update to this plugin removing that tag from the source. Can you please update and verify?

robogeek commented 7 years ago

When I removed that META tag it caused other problems.

The HTML/BODY tags your site see's are spuriously inserted by using the DOM library. I've changed the plugin to remove those HTML/BODY tags before returning the HTML from the filter function.

I've pushed an update to version 1.5.5 .. can you please update and verify?

shubhendusaurabh commented 7 years ago

@robogeek Sorry for the late reply. Just checked and it seems issue has been fixed. Thank You :smile: