homepage Welcome to WebmasterWorld Guest from 54.145.209.42
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Getting Google Code to Validate Using the W3C Validator
Sally Stitts

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4423970 posted 7:10 pm on Mar 1, 2012 (gmt 0)

I thought I would revisit the issue of page validation, using [validator.w3.org...]
I fixed all MY issues, but there remained 2 pieces of Google code that failed to validate.

The first "code hiccup" was the Red Google Plus button.
Here is the code which Google provided -
<A HREF="https://plus.google.com/107520370013#*$!#*$!#*$!" rel=author>
<IMG SRC="http://ssl.gstatic.com/images/icons/gplus-16.png" WIDTH=16 HEIGHT=16 ALIGN=bottom></A>

The W3C validator said "no alt text".
Here is the modified code which fixed the error -
<A HREF="https://plus.google.com/107520370013#*$!#*$!#*$!" rel=author>
<IMG SRC="http://ssl.gstatic.com/images/icons/gplus-16.png" ALT="Red Google Plus Button" WIDTH=16 HEIGHT=16 ALIGN=bottom></A>

The second "code hiccup" was the Google +1 button.
Here is the code which Google provided -
<g:plusone></g:plusone><SCRIPT LANGUAGE="" type="text/javascript">(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();</SCRIPT>

Here is the modified code which fixed the error -
<div class="g-plusone"></div><SCRIPT LANGUAGE="" type="text/javascript">(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();</SCRIPT>

Apparently, the <g:plusone></g:plusone> code is fine for HTML5, but unacceptable for HTML4.
Does Google assume that everyone is using HTML5.? BAD ASSUMPTION! Really bad. HTML5 is still experimental, is it not?

With these 2 Google code changes, my pages now validate 100%.

Did I get it right? I am not a programmer.
Please comment.
Thank you.

 

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 3:12 pm on Mar 3, 2012 (gmt 0)

If your g+ button still works, you did, but won't be able to use all the +1 attributes. I've seen that solution around and apparently it does work. You could also do it with XHTML and validate the g: namespace (untested, but have seen this solution:)

<html xmlns:g="http://base.google.com/ns/1.0">

The other is to use Javascript to add G's attributes to HTML4 elements:

<div class="g-plusone" id="gplusone"></div>
<script type="text/javascript">
g1=document.getElementById("gplusone");
g1.setAttribute("data-size","medium");
g1.setAttribute("data-count","true");
</script>

A few purist corrections, that are just good habits to form:

Quote your attributes. Also lower casing attributes makes it much easier to switch between doctypes if you need to.

width="16" height="16">

not

WIDTH=16 HEIGHT=16 ALIGN=bottom>

Align, valign, and other presentation attributes are deprecated. I'm surprised it didn't kick a warning. Use CSS for presentation requirements instead.

In 4, the language attribute is deprecated, you only need type (which is NOT needed in 5.) Yours is empty anyway, and same comment on case.

<script type="text/javascript">
//
</script>

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 4:11 pm on Mar 3, 2012 (gmt 0)

Using
alt="" would also be fine.

I recently wondered why the word "base" sometimes appeared in the snippet for some pages of a site I recently worked on. I soon noticed that this was the alt text for the image used as a border around the page footer navigation list. The
alt="base" now reads alt="" instead.

Use lower case for atribute names and add quotes around the value.

Sally Stitts

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4423970 posted 7:33 pm on Mar 3, 2012 (gmt 0)

Since I am not a programmer, I must rely on Google's supplying of code snippets.
I just checked again. My head is spinning.

EVERY D@MNED TIME I visit the the Google code snippet for the Google Profile button, it has been changed.
Four times now, that I am aware of.
NOW, it was -
<A HREF="https://plus.google.com/107520370013#*$!#*$!#*$!" rel=author>
<g:plus href="https://plus.google.com/1075203700139#*$!#*$!xx" width="300" height="69" ></g:plus>

EVERY D@MNED TIME I visit the the Google code snippet for the Google Plus button, it has been changed.
Four times now, that I am aware of.
The <g:plusone></g:plusone> code is
NOW <g:plusone annotation="inline"></g:plusone>

First, it was the asynchronous thing. After that, it was the fixing of omitted code.

I am going to make a bold statement here -
"Google is TERRIBLE at providing "code snippets".
Isn't there anyone over there that knows what they are doing?
I say no, not any longer. The geniuses are gone, and the bean counters are now running the show.

Here is my deal. I do not use any CMS. All of my pages are designed individually, by hand, by me. It takes me 2 weeks to go through all my pages and change the codes. This really irritates me. I am about ready to chuck all this "Plus" BS, and take any hit coming my way. Maybe try it again in a year - perhaps Google can get it right by then.

The problem is, that for the first time, my AdSense run rate is 6 figures, not including cents. So I am motivated to try and comply with all of Google's wishes. But for how long?

I would much rather concentrate on producing content, and not fixing Google's amateur, trashy, ill-conceived "code snippets". Once again, I feel like the guy in the old cowboy movie, with the bad guys shooting at my feet, shouting "Dance, you SOB, Dance!"

Does anyone have anything to say about that? I'm piffed.
I'm not going to have enough time to edit this enough to get it right, before I am cut off. So I will just go away, and discuss this on my site, where I WON'T get cut off. All I can concentrate on now is racing to hit the submit button. This will take me hours to document.

If I am going to post something long and complicated here, I need to do it first in TextWrangler, and then post it here. As in, code 1 (date), code 2 (date and what changed), code 3 (date and what changed), code 4 (date and what changed), etc., etc.

It would be EXTREMELY helpful if Google gave us a LIST of their changes, but that won't happen, because it would highlight their incompetence. Everyone must continue to check back, and endlessly revise their "code snippets". Or sink into oblivion. WAY BEYOND just frustrating.
.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 8:55 pm on Mar 3, 2012 (gmt 0)

Here is my deal. I do not use any CMS. All of my pages are designed individually, by hand, by me. It takes me 2 weeks to go through all my pages and change the codes.

Ouch! Make a note of the file extension and get your server set up to parse that file extension for PHP code.

Then put that code in a small file all on it's own and save it. Next, on every page of your site delete the code snippet and replace it with
<?php include "codesnippet.html"; ?>

The next time you want to alter the code snippet you only need to alter it in one place in one file.

If you can't do any of that, at least invest in an editor like EditPlus3 that allows you to edit multiple files all at once.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4423970 posted 9:35 pm on Mar 3, 2012 (gmt 0)

You don't have to change all your code every time g### offers up something new. I grubbed around until I found

<a rel = "author" href = "https://profiles.google.com/{buncha numbers}">link text</a>

or exactly the same thing with a plus button instead of text. It's in plain English-- so to speak-- and it works.

I know it works because recently I forgot to sign out before doing a search, so I got "Personalized Results". Made me furious. I don't want 87 links to my own site. I already know how to find my own site, thank you very much. I want to know what normal people see.

Sally Stitts

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4423970 posted 11:30 pm on Mar 3, 2012 (gmt 0)

g1smd - I am afraid I don't understand what you are talking about, but at 16K posts, I know that you do. Mindboggling.

I am a 68-year-old hardware engineer, whose best work was done over 35 years ago. I have been faking software knowledge, by teaching myself HTML4 from the Internet. AdSense has paid me 100s of 1000s since 2004, but I am now in way over my head, with all of their special requirements, which NOT EVEN THEY can get right.

It may now be time for me to sign up for my Social Security benefits. I'll leave the AdSense up, and just let it run. But as far as continuing to jump through Google hoops, I'm just about done. No follow, canonical, Google-specific authorship, required cross-linking, analytics, google search, +1 buttons, +1 badges, totally bogus WMT stats, search vs. AdSense conflicting directives - it is NOT the Internet any more, it is the Google-dominated Googlenet. And I have grown weary of it. ESPECIALLY, trying to comply with increasing Google requirements, that they can't even code properly. They hide dates, and redirect to the new stuff, because they don't want you to see their screw-ups. The game is now entirely for CS majors, not guys like me. Screw it. I will pick my frustrations elsewhere, where I won't have to endure the feeling of being a slapped around b|tch.

AdSEnse - "Add more ads above the fold."
Search - "If you do, we will send you to ranking He||."
What a joke. Kiss one Google a$$, and another Googler comes along and kicks YOUR a$$. Great.

Thank you all for your fine suggestions.
But unfortunately, its not so easy teaching an old dog new tricks.
I never was very good at sucking up. Maybe that is why I had over 50 jobs. After this, I will NEVER suck up to anyone or anything again, like I did with the Borg.

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 6:15 pm on Mar 4, 2012 (gmt 0)

One reason that Google sometimes offers code snippets that don't validate is that the kind of validation "problems" that do exist don't really matter very much. They don't affect SEO, and they don't affect a browser's ability to display the page properly.

HTML is an extremely forgiving technology - by design. It's not like C++ or any hardcore programming language. In cases like this, I usually don't worry about perfect validation - life's just too short!

Knowing when a validation shortcoming really matters and when you can safely let it slide can bring a lot of ease into your online life. No alt text is one of those "doesn't matter much" areas. Invented tags like <g:plusone> also don't really matter - browsers will just not worry about them.

Sally Stitts

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4423970 posted 8:33 pm on Mar 4, 2012 (gmt 0)

I agree with Ted. I just don't like "loose ends", and I thought I would try and fix it.

What really bothers me here is not so much the non-validation.

It is Google
1. CONSTANTLY changing the code they give us
2. Not telling us when there is new code
3. Hiding the code that they have secretly denigrated
4. Not telling us the problem(s) caused by the old code
5. Google expecting us to continually upload new code, and acting like that is normal, when in fact, the code they have provided has been lousy. "Improved code", although true, is a misnomer. It is "fixed code." I'm through updating. If it fails to function, my next "update" will be removal. I'm just tired of having my chain yanked.
.

incrediBILL

WebmasterWorld Administrator incredibill us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4423970 posted 8:41 pm on Mar 4, 2012 (gmt 0)

Since I am not a programmer


Don't worry, HTML isn't programming, it's text markup.

Glorified 21st century high-tech typesetting to be exact :)

However, if Google doesn't care if their own code validates I would question whether the search engine cares that much about 100% valid code.

Personally, I don't feel bad if my page validates but the little piece I added from the big mega-billion dollar company doesn't validate.

I'd point that out to a client and show them you simply do better work than Google does ;)

BillyS

WebmasterWorld Senior Member billys us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 10:05 pm on Mar 4, 2012 (gmt 0)

One reason that Google sometimes offers code snippets that don't validate is that the kind of validation "problems" that do exist don't really matter very much.

<rant on>This is true and it demonstrates Google's arrogant attitude towards the community of webmasters. Its the same reason my site downloads in 2.8 seconds instead of 1.8 because of the crappy code Google junks onto the web.

Above the fold, javascript that isn't compressed, lack of expires headers... the list goes on and on. Beta, beta, beta... an excuse for laziness.

How hard is it for one of the geniuses at Google to give us some good code? No instead 300,000 webmasters have to figure out how to get around their litter.</rant off>

I feel better now. :)

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 10:10 pm on Mar 4, 2012 (gmt 0)

Of course, you can always detect searchengine bot requests and then fix things to not feed their own slow junk back to them.

I've been looking at many page previews with big empty spaces. In many cases it is Flash content but in others it's supposed to be a Google map. Previews look a lot better when you feed a simple GIF back with the same content.

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 4:43 pm on Mar 5, 2012 (gmt 0)

How hard is it for one of the geniuses at Google to give us some good code?

Their problem - too many geniuses, all on a rapid iteration program and with different specialties and priorities.

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 4:51 pm on Mar 5, 2012 (gmt 0)

It takes me 2 weeks to go through all my pages and change the codes.


Also still a hand coder after all these years . . . .

I suggest shopping for a new text editor, one that does search and replace on files without opening them. I'm guessing you're on Mac, using TextWrangler, so the options are not as open as Windows. I still use HomeSite, which was originally released by Macromedia as an Extra with (then) Studio MX, then killed when Adobe bought it. It can chew through thousands of files in under 30 seconds on a global search and replace.

I look at it a different way. G's developers know so much more than I do (maybe, TOO much) and I have to keep growing just to keep up. :-/

Sally Stitts

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4423970 posted 1:42 am on Mar 7, 2012 (gmt 0)

Yes, Mac. I've never heard of Homesite before. After chasing it on the net for a few hours, I see that it was (and still is) HIGHLY thought of. I would live to try it. I put a lot of stock in "word-of-mouth" reports.

However, after telling Google to search for "download homesite for Mac -pc", all I get is PC stuff. I even tried my old Limewire and Transmission, which no longer function. The pc version can still be purchased from Adobe, but the Mac version was killed in 2009.

I have tried Dreamweaver, but it is so slow, bloated, and unintuitive, you would think it was an MS app. I hate it.

To really highlight my late-adapter personality, I still LOVE Claris Homepage from 1997. Fast, elegant and reliable, I have found a workaround for all of its screwy hiccups. I feel that nothing as elegant has been created since. I can create web pages with the stream of my consciousness - totally uninterrupted by wondering what to do, or how to do it.

It sounds like Homesite would perfectly compliment it. My quest continues. I know it is sitting out there somewhere, waiting for me to find it. I need to update my find-and-retrieve skills, unused for years.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4423970 posted 3:46 am on Mar 7, 2012 (gmt 0)

I suggest shopping for a new text editor, one that does search and replace on files without opening them.

After some experimenting I found that the magic words are "batch processor", and quickly downloaded two different programs to play with.

I suspect this is one of those things like unsupervised global replaces using Regular Expressions that take a long, long time to work up the courage to do ;) But when the alternative is to venture into Server Side Includes...

Quadrille

WebmasterWorld Senior Member quadrille us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4423970 posted 10:37 am on Mar 7, 2012 (gmt 0)

I don't see a need to update Google snippet code everytime it chnages - but then, I never, ever worried about 100% validation, that way madness lies.

Google is changing all the time, and code updates reflects this; kudos to them that old code still works!

But if you are a code zealot (and nothing wrong with that, as Seinfeld would say), then you really need to study Server Side Includes - either php or not.

It's really simple stuff - but life changing for we who code pages one-by-one.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved