Page 1 of 1

Affiliate links errors/warnings

Posted: Fri Mar 14, 2014 8:39 pm
by Arnvid
Just got both CSE HTML Validator & TopStyle, and know I will be happy with both programs which I know a bit from before. I have basically been working with HomeSite, and today DreamWeaver - since 1994, and now I'm happy to include CSE and TS to my appreciated tools. Reason for this is first of all that I find CSE HTML Validator more throughout compared to W3C validations service.

I have done a pretty good number of sites since '94, built them from scratch - but this time I wanted to use a template and try to build my new site based on this (basically due to workload and deadlines other places). This is also the first time I add affiliates, as I never wanted to have this before - but this time it's logic to add related books to page content.

So here is my question:
The affiliate code I got to use, produce both errors and warnings - but on one side I want the affiliates to bring some income - so I got to have a working affiliate link. On the other side, I of course want to have a site that is correct html/ccs.

I know this is difficult to talk theoretical about, so let me give a link to a page that is up. Here it's an article, and the affiliate link on this page is a book related to the article. The code here is:

<a href="http://www.amazon.com/gp/product/B004EY ... g=nilev-20" target="_blank"><img src="../images/affiliates/cityofthedeadcairo_hassanansah180.jpg" width="180" height="257" alt="book about the city of the dead in Cairo"><strong>Life, Death, and Community in Cairo's City of the Dead</strong></a>
<img src="http://ir-na.amazon-adsystem.com/e/ir?t ... B004EYT2UW" width="1" height="1" alt="city of the dead in cairo" style="border:none !important; margin:0px !important;" />

<img src="http://ir-na.amazon-adsystem.com/e/ir?t ... 037570812X" width="1" height="1" alt="city of the dead in cairo" style="border:none !important; margin:0px !important;" />Hassan Ansah's book take you into the City of the Dead in Cairo, a part of the city that is less known even to the locals - that is apart from the 3 million who actually lives in this cementry.

So how can I avoid errors/warnings when it's a link from an affilated provider, as Amazon here?
BTW - the page with this code given over, is here:
http://www.nilevikings.com/articles/cit ... ead_1.html

PS - got more questions to the forum, but I guess it's best to take one and one problem (-:

Thank you in advance.

Re: Affiliate links errors/warnings

Posted: Sat Mar 15, 2014 9:29 am
by Arnvid
Just a short update here. I have changed the language to "polyglot" and edited the page based upon CSE HTML Validator. Starting to get it fixed, but the remaining problem is affiliate links - here the one generated by Amazon (as mentioned above)

<a href="http://www.amazon.com/gp/product/B004EY ... g=nilev-20" target="_blank"><img src="../images/affiliates/cityofthedeadcairo_hassanansah180.jpg" width="180" height="257" alt="book about the city of the dead in Cairo"><strong>Life, Death, and Community in Cairo's City of the Dead</strong></a>
<img src="http://ir-na.amazon-adsystem.com/e/ir?t ... B004EYT2UW" width="1" height="1" alt="city of the dead in cairo" style="border:none !important; margin:0px !important;" />

<img src="http://ir-na.amazon-adsystem.com/e/ir?t ... 037570812X" width="1" height="1" alt="city of the dead in cairo" style="border:none !important; margin:0px !important;" />Hassan Ansah's book take you into the City of the Dead in Cairo, a part of the city that is less known even to the locals - that is apart from the 3 million who actually lives in this cementry.<br />

Next problem is also an external generated code, this time from Creative Common:

<a class="go_to_top scroll_top_infooter" href="#" onClick="return false;">top</a>
<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons-lisens" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/4.0/88x31.png" /></a><br />
<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">NileVikings site</span> er lisensiert under en <a rel="license" href="http://creativecommons.org/licenses/by- ... ">Creative Commons Navngivelse-IkkeKommersiell 4.0 Internasjonal Lisens</a>.<br />

Both found on then mentioned page
http://www.nilevikings.com/articles/cit ... ead_1.html

Re: Affiliate links errors/warnings

Posted: Sun Mar 16, 2014 9:40 am
by Albert Wiersch
Hello,

It seems most of the issues are due to them not encoding ampersands in the URLs. The '&' character should be encoded as "&". I don't know why so many places give poor HTML that could easily be fixed.

Try changing the '&' characters to '&'. If done properly, then the links should work the same way or better, and they will also validate.

The other issue is the use of the "xmlns:dct" attribute in HTML instead of XHTML. Such attributes are allowed in XHTML but not in HTML. In practice, I don't really see any issues with this so you may want to just disable that message in CSE HTML Validator. Alternatively you could use XHTML instead but this will probably create more issues that you really don't need to deal with.

I hope this helps!

Re: Affiliate links errors/warnings

Posted: Mon Mar 17, 2014 1:03 pm
by Arnvid
Yes, changing all '&' characters to '&' did the trick (-:

Agree totally with your sigh about why "so many places give poor HTML that could easily be fixed". One should at least think that large companies as amazon.com would at least take care about their affiliates, so they don't implant bad html into their sites. Fact is that I had a discussion with a leading SEO person in Europe (who also did SEO in Europe for one of the major US tv/media houses). I respect highly his SEO experience and techniques who contained no short cuts - but his attitude towards correct html was that this was not so important. For me it's highly important, both for the receiver of a site - as well a kind of self respect for the builder (-:

The problem with the Creative Commons link I solved by rewriting the code, as this is only to redirect to a CC-page.

So I do hope all other who got problem with affiliate links, read Albert's answer here - and the amazing easy solution.

Then just a last question in this success story - as I chosen polyglot language, is the code for this option correct as this, or is it anything here that could be better? :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="en-US" lang="en-US">

Re: Affiliate links errors/warnings

Posted: Mon Mar 17, 2014 1:11 pm
by Albert Wiersch
Arnvid wrote:... but his attitude towards correct html was that this was not so important. For me it's highly important, both for the receiver of a site - as well a kind of self respect for the builder (-:
That seems to be the prevalent attitude. I suspect probably because it's just easier to ignore the problems, especially when browsers will usually compensate for them.

But I agree about doing it for self-respect! A site that validates really stands out as quality compared to one with lots of problems.
Arnvid wrote:Then just a last question in this success story - as I chosen polyglot language, is the code for this option correct as this, or is it anything here that could be better? :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="en-US" lang="en-US">
I don't see any problems with that, though I think the dir="ltr" attribute is unnecessary and could be removed.

Re: Affiliate links errors/warnings

Posted: Mon Mar 17, 2014 1:16 pm
by Albert Wiersch
I had an interesting thought regarding the broken HTML given out by sites like amazon.com and others.

What if they gave the user a choice as to what HTML they wanted:
1) HTML that is correctly constructed, validates successfully, and works in browsers
or
2) HTML that doesn't validate, isn't technically correct, but still works in browsers anyway

How many people would choose #2 over #1? Probably not many.

And I wonder what people would think if they were given such a choice... they'd probably ask why they would want broken HTML when they could have correct HTML.

Re: Affiliate links errors/warnings

Posted: Mon Mar 17, 2014 2:47 pm
by Arnvid
Agree totally with you. I will BTW inform amazon affiliate service about your easy solution for fixing their links, and tell them about where the fix come from. Both CSE HTML Validator and W3C Validator mark this as not valid. Will let you know any answer from their side.

PS - above you wrote "The other issue is the use of the "xmlns:dct" attribute in HTML instead of XHTML. Such attributes are allowed in XHTML but not in HTML. In practice, I don't really see any issues with this so you may want to just disable that message in CSE HTML Validator."
Surely a lame question, but where do I disable an individual message in CSE HTML Validator?

Re: Affiliate links errors/warnings

Posted: Mon Mar 17, 2014 2:59 pm
by Albert Wiersch
Arnvid wrote:Agree totally with you.
Great. :D
Arnvid wrote:...where do I disable an individual message in CSE HTML Validator?
Please have a look at this page:
http://www.htmlvalidator.com/v140/docs/ ... ssages.htm

I would recommend disabling that message 'by exact text match'. All you have to do is right-click on it when it displays in the Results Window and choose the appropriate option.