Get Help Ranking
Tim Hill SEO
How to SEOin2024
With me, Tim Hill

How to SEO your website code

This sounds techie but it doesn't need to be. And its essential we go visit website code on our SEO journey because it could be causing major issues when it comes to better rankings!

Is your website over reliant on Javascript?

There's an easy way to find out. Open a page on your website and make a note of some text content which appears in the main content. Not the title but a sentence from somewhere in the main body of the page.

Now:

  1. Find a blank space on the page and right hand click.
  2. From the small popup menu that appears left hand click on 'View Page Source'.
  3. Eeeeek!? Don't be phased. Hold down Ctrl and F at the same time and look for a small search box that will appear in the bottom left or top right
  4. Type in that text you noted earlier

Did you find it? Great, we can SEO this content right now - scroll down to the next section on this page about code validation. But If you didn't find your content in your code that means your website has probably been designed with Javascript and you'll struggle to Search Engine Optimize fast. You're going to have to fix that.

Search engines can read Javascript pages but they are slow at doing it because they use a process known as second wave indexing. Here's how it works:

When you visit a page your browser (Firefox, Chrome or whatever)

  1. reads the source code, what you just searched a moment ago
  2. renders the page - basically does the things the code tells it to which make it all lovely and pretty for humans and activates features such as pop up images and slide shows and other javascript based features.
  3. Action external files - which might do things like check the users location before deciding what content to display.

But when a search engine visits your page it just reads the page source code. They don't render the page. Later when they have some free time they will render the content. This secondary action is the second wave indexing.

If your page is 90% Javascript a search engine won't action that type of code until it does its second wave index. This could be days, weeks or even months after its first visit and it is only then that the search engine discovers what content you actually have and what links exist to other pages on your website.

So not only are search engines going to be slower at discovering your content, they're also going to be slower at discovering links to other pages on your website - its a double whammy of bad SEO news.

Further down the line when you make changes you might have to wait weeks again until search engines like Google actually acknowledge your edits.

If you have a Javascript driven website there is no need to abandon it but you will probably need technical help to ensure that whatever is in the Javascript version also exists outside it in a place search engines can see it on its first visit and follow the links it contains.

For more on this specifically see my piece What does second wave indexing mean in SEO? which explains how to test a page and how to resolve issues.

Code checking for non techies

Search engines aren't sticklers for good coding. They'll do their best to root through your page source code no matter how many errors there are ... but why make life difficult for them?

Websites are usually made up of two core elements:

  1. HTML code - that's the source code you searched earlier.
  2. CSS code - this is code that tells browsers stuff like what color and size the text should be in different places, how wide that bit should be or what a link to that other page should look like.

You can check both of these online very quickly using the following free tools:

The chances are your website is not going to pass with flying colors because very often plugins like a Facebook like button throw errors. All you need to check is your side of things and reduce errors down to a minimum where you can.

To do so you might need some help from a programmer to understand if the errors are critical - they might cause your page not to render correctly in some circumstances - or small and nothing to sweat about.

I do get clients come to me who have hundreds of errors and it really is a lot of noise that the search engines could do without. A good chunk of search engine optimization is about making pages search engine friendly and pages with buckets of HTML or CSS errors are not search engine friendly.

How poor code makes unhappy users and bad SEO

I mentioned earlier errors in your code can cause your website to display poorly in some browsers and there are so many different browsers out there that you can't possibly test them all.

However if your website is already getting a fair number of visitors and you know your code has errors you can look for clues as to which browsers struggle with your content.

  1. Open Google Analytics and select Audience > Technology > Browser & OS
  2. From the list of Browsers look for the ones where you had more than 30 visitors (enough data to know for sure if there is an issue). If the numbers are low you can change the date range in the top right of the screen to cover a longer time period and give you better data.
  3. Now check if any browsers have an unusually high bounce rate and low Avg. Session Duration compared to others. If they do there is a good chance that the errors reported by the validators are causing issues in those browsers and you'll need to get techie, or get techie help, to resolve those.
  4. You can also carry out the same test to see if users of specific devices aren't liking what they see.

This was exactly the issue that was affecting a client who came to me recently. When we looked at his Analytics we found visitors with iPads were bouncing far more often than users with other devices. We resolved the issues and his sales doubled.

Also, for every user who finds you in a search engine but then backs out fast because your content does not display correctly in their browser, the search engine takes note. In their eyes your obviously not serving them well so perhaps you shouldn't be ranking there at all ....

Yes, coding errors that creep in can actually kill rankings you already have so keep on top of them.

Code issues that aren't errors

Most websites are on platforms like WordPress which make it really easy for you to create content without flaffing around in the code to make everything look great. However when work is regularly edited invisible issues in code can start to gather.

Here's some code I recenly saw on a client's website:

<b><span style="font-weight: bold;">T</span><span style="font-weight: bold;">raffic</span></b>

Users will see the word Traffic just fine but search engines might not because rogure code is breaking up the text.

A Validator won't flag this because in code terms there is nothing wrong.

Usually your platform will have a way for you to check this. In WordPress, open a post or page to edit and at the top right of the main text entry area you will see two tabs: Visual and Text.

Click on the Text version to see much of the underlying code and check for issues like the example above, especially where words are being physically broken apart.

If you are not on WordPress but you are using a Content Management System of off the shelf product have a search on Google or ask on a relevant forum to see if a similar option is available for your platform.

Summing up

You don't need to be a techy to know if your code is bringing down your SEO but you might need to help to resolve them. Don't skip this vital SEO work if you are serious about search engine optimizing. If you do you could be doing all your other SEO with one hand tied behind your back.

Check if your website is Javascript driven, check your HTML and CSS using online validators, check your text content is not swimming in code that is breaking up words or simply making the page unnecessarily code heavy and, as your website expands and evolves, remember to run new checks now and again.

Tim Hill SEO

I'm Tim Hill, a Search Engine Optimization and Online Marketing specialist. I created this site to help others understand that SEO is not a mysterious black art!.

If your a newbie try the Getting Started in SEO page, otherwise feel free to dig around and learn more.

If you need help simply get in touch.

Need Help? Seo Assistance
this man can affect your rankings