find a location for property in a new city
Showing posts with label developer. Show all posts
Showing posts with label developer. Show all posts

Friday, 30 July 2010

Developers' guide to search engine optimisation

Search engine optimisation (SEO) is quite a dark art because it is kept somewhat secret by the guys who write the search algorithms. In fact you can make a career out of SEO but that's not you is it. You're a developer and you just want to know roughly the SEO concerns that you should consider when developing a site. No? Oh... well you should. Here is your guide

Status codes and SEO

If you are a developer worthy of gracing the work place you will be well accustomed with 500's and 404's but I notice a lot of interviewees can't tell me what a 301 is. Understanding how different status codes affect SEO is an important start.
301 Permanent redirect
The URL you requested is wrong and should never be used again. Here is the new one. A user won’t see it but a search engine will make a note and be sure to move all its current indexing and value for the old page to the new one.
302 Temporary redirect
The URL has moved somewhere else for now. Search engines will not re-index their page to this new one so will continue to send people to the old page. Your site then 302's them to the new place. This is used for when it is not usual behaviour (e.g. submit new post and you get redirected to that post). Also if you want www.mysite.com?lang=enGB to appear like www.mysite.com on Google this is the one for you.
404 Not Found
Not cool because Google will thing you are an unreliable joke of a site.
500 Internal server error
Not cool because Google will thing you are an unreliable joke of a site. A sneaky Pete will issue a 503 instead.
503 Service unavailable
Means your server is down for some reason. May be maintenance. May be a crash. Whatever it is Google feels sorry for you and will return later to see if it's back. So make an HttpModule that chews up 500's and returns a HttpStatusCode of 503.

Duplicate content

Google despises you for this. If you had a page here: http://www.mysite.com/socks that just contains a list of your favourite socks for example, that's fine. If you also had the exact same list located at http://www.mysite.com/list-of-socks search engines would penalise you for duplicate content. Fair enough really because you are deliberately trying to have more pages about socks on your site by copy and pasting the same page.

But there are more subtle variations that if Google finds will tick you off for duplicating content. The following are variations on http://www.mysite.com/socks that do in fact count as duplicate content (unless the content is entirely different of course):
Actionless querystring
E.g. http://www.mysite.com/socks?source=email . Say you were logging the source for analytics and the source had no affect on the content. This URL would be marked as duplicate content to http://www.mysite.com/socks
Mixed casing
E.g. http://www.MySitE.com/sOcks. I know IIS is case insensitive but there are web servers that are not so Google counts the different casing as a different page and therefore duplicate content.
Secure pages
E.g. https://www.mysite.com/socks. The different protocol makes search engines count this URL as a different one from the original.
What to do?
To resolve all of these things you should look into using canonical URLs. Essentially if you put <link href="http://www.mysite.com/socks" rel="canonical" /> in the <head> section search engines will take that as the URL for the page and attribute any value for pages that include that canonical link to that particular URL.

SEO Friendly URLs

I did believe that friendly URLs are not only user friendly but also good for SEO too. Dan Atkinson pointed out that Google do not add weight to a site based on URL. However, another post from Google suggests that site hierarchies are infact used. (If Google aren't looking at URLs for SEO I wonder why they rewrite all their blog posts...)

Regardless of your leaning I would still recommend that clean URLs are considered even if it is only for the benefit of the user. A URL like http://www.mysite.com/articles/price-of-socks-plumets will have more chance of being linked to or being the URL of choice to click from some search engine results than http://www.mysite.com/articles.aspx?a=9031. Of course you will have to do a database look up based on that string rather than the ID so maybe you may prefer to use http://www.mysite.com/articles/9031/price-of-socks-plumets instead.

To make cleaner URLs you should look into URL Rewriting or ASP.NET 4's Routing engine.

SEO Friendly content

Basic stuff really, make sure you have filled the <title> with the title of the page. All your headings are within <h1>'s, <h2>'s and <h3>'s etc. Make sure you have a <meta content="Everything about socks" name="description"/> and a <meta content="socks, clothing, accessories" name="keywords"/> can't hurt either.

In ASP.NET 4 you can set easily using Page.MetaDescription and Page.MetaKeywords

Follow britishdev on Twitter

Saturday, 3 April 2010

Colouring code with Syntax Highlighter

I need to colour my code samples to make it more readable and more like your IDE. I have been putting spans around each key word to colour manually and being a developer I know there must be an easier way! So I did some research and found that it is all about SyntaxHighlighter! Here is how to use Syntax Highlighter to colour your code.

  1. So first up you need to put this in the page head just before the </head> tag:
    <link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
    <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
    <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
    <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script> 
    <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script>
    
    <script language='javascript'> 
    SyntaxHighlighter.config.bloggerMode = true;
    SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
    SyntaxHighlighter.all();
    </script>
  2. Then you simply surround any code in these tags:
    <pre class="brush: csharp"></pre>
I have used C# for my example but there are many more languages that can be specified. I only import the C# and SQL but you can get more if needed.

Follow britishdev on Twitter

Wednesday, 3 March 2010

London Bridge is burning down! I'll work from home

Today I arrived at my local train station set for my 15min journey into Central London only to find all my trains were cancelled due to a fire at London Bridge station. I found the only alternative was a 2 hour big red bus journey guarded by a mosh pit of people fighting for the one or two spare standing spaces.

With our modern world I don't need to be at work to do my job. I can easily fire up the VPN and do my development work remotely. So I gave my boss a bell. He is very understanding and having a development background he understands the advantages of working from home on occasions and so he granted my request. Despite his understanding, however, the company wide policy is to only allow working from home in emergencies and so had to explain his reluctance.

I can understand a company wide default policy of 'work from home only in emergencies' but am not sure it should apply to developers in all instances. Most people where I work cannot do their job from home. Many of the staff depend on meetings and interaction. Conversely, meetings and interaction mostly prevent me from working and so I have relatively very few.

Of course I need to be at work most of the time. People need me to estimate technical solutions and timescales and I need to be on hand generally. I can't just put my head down and write code all the time (as much as I'd love to). Today I worked from home and I am not joking when I say I got through work estimated at almost 20 hours in the space of my standard 7.5 hour day.

I suppose the problem is if the developers I work with are allowed to work from home on occasions then everyone will want to. Then there will be at least one person taking the piss - there always is.

With development having such a tangible metric (e.g. code commits to source control, features materialising) and there being the huge advantage of being able to pump out huge amounts of work more than usual due to lack of distraction can there not be some compromise?

Follow britishdev on Twitter

Tuesday, 2 March 2010

Why should I make a developer blog?

About 3 years ago a friend of mine I used to work with told me he was going to make a developer blog. He planned to put all the interesting discoveries he made whilst going about his day job coding ASP.NET/C# into a blog.

So I did what's right; I called him an idiot and took the piss out of him for having such a stupid idea. He is a mate after all. Anyway, 3 years on and I'm starting to think he could have been on to something. I mean blogging has caught on somewhat...

I too am a (predominantly) ASP.NET/C# and SQL developer and I have been doing this work intensely for about 4 years now. I could not have got anywhere near the level of experience I have if it weren't for the plethora of blogs and forum posts a mere Google away.

So I have everything I need; why should I make a developer blog? I know I make interesting discoveries that other developers can benefit from but how does that help me?! I know this is incredibly selfish and we'd all be worse off if everyone subscribed to this viewpoint but even still this is my spare time we're talking about and there is beer to be drunk.

I'm still not 100% sure why I should start a developer blog at this point if I'm honest. However, here are a list of reasons that have motivated me to come this far:
  • I often work out solutions to problems myself after intensive Googling has failed me. It must be criminal to sit on these secrets
  • My use of blogs so far is almost entirely selfish and that is just being rude
  • I must be getting older (currently approaching 26) because I can feel irresponsibility slipping through my fingers
  • I'm proud of my work so why not show it off
  • I can forget the solutions to problems I have previously solved. This is good documentation too!
  • I would be so so happy with myself if I started to get the feeling I was helping people
  • I think writing a blog that really actually helps people is a new and massive challenge for me. I'm really interested to see if I can do it
  • I would take great pleasure to see people reading and commenting on my posts. Absolutely love it

On that note, please feel free to comment on this post if you can think of any other motives for blogging or if you have any feedback for my first post :)

Follow britishdev on Twitter