Heads up on <head> tag optimization (SEM 101)

Much of what constitutes a well-architected webpage is never displayed in the page itself. The contents of the <body> tag are what you see in a browser. But a webpage consists of two major elements, the <body> tag only being one. The content of the <head> tag (and for that matter, the document type declaration (DTD), which precedes the <head> tag in the page’s code, is just as important for search engine optimization (SEO). It includes information about the page for the browser and the search engine to use. The quality of that information, even its presence (or lack thereof), can make a big difference in how a page gets ranked.

Just like the earlier posts in the Site Architecture and SEO series (including files/pages, link/URLs, and content), helping the search engine web crawler (also known as a robot or, more simply, a bot) crawl your site is a wise idea. If you spoon-feed it the information it needs to know about your pages, the better prepared it will be in ranking your pages for relevance to keywords users employ in their queries. This article is the last of this 4-part, Site Architecture series.

But before we can get down and dirty in <head> tag optimizations, we must first address the issue of the page’s DTD. Once we settle on a doc type, many of the optimizations I will subsequently specify will come into play.

Choosing between HTML and XHTML

To cut to the chase, HyperText Markup Language (HTML) is so 20th century! The World Wide Web Consortium (W3C), the official body that manages the Web by creating public standards and guidelines, long ago determined that HTML was a limited-use language. It’s primary purpose was for displaying information on webpages. And as webpage content became ever more diverse, sophisticated, and filled with data, a new method of coding was needed.

EXtensible Markup Language (XML) is similar to HTML in that it is a text-based, markup language, but it differs in two key ways:  

  1. Whereas the purpose of HTML is to display information, the purpose of XML is to classify data. It’s similar to a tag-based database application.
  2. Whereas HTML has a limited number of specific tags and attributes, XML is free-form. The XML user defines the tags to be used.

As a result of local control of tag definitions and the ability to classify data, XML can be a very tightly managed and powerful language. While its capabilities were compelling, its lack of a formal, preset structure precluded its direct use as a Web language. So back in 2000, the W3C approved the use of EXtensible HyperText Markup Language (XHTML), a hybrid of HTML and XML for use on the Web (who knew it has been around so long?).

Why is this history lesson important? Because at the very top of each webpage you manage, there needs to be a DTD statement defining the page document type with a referral back to the standards definition for that type.

While HTML was useful in its day, XHTML is the way to go today. The advantages of XHTML are numerous:

  1. XHTML is almost identical to and fully backward compatible with HTML 4.01
  2. XHTML is more extensible than HTML
  3. XHTML is HTML defined as an XML application
  4. XHTML is a stricter and cleaner version of HTML
  5. XHTML 1.0 has been a W3C Recommendation since 2000

The stricter and cleaner part of XHTML is key. Pages that adhere to the XHTML standard are considered “well-formed” and are readable by any Web browser. Modern, major Web browsers on computers are really sophisticated and can read poorly written HTML code and still pretty much make it work. However, smaller browsers, such as those on mobile devices and other, small platforms, are not as forgiving, and that can be a problem (and always think of search engine bots as small browsers!). XHTML code validation is tight, and if your XHTML code passes validation, it’s good on all browsers. And as new XHTML functionality is needed, it can quickly and easily be made available by the W3C. For more information on how to use XHTML, check out this XHTML tutorial.

Tip: While XHTML tags are very much like those in HTML, they sometimes have different coding requirements. XHTML tags must always be written in lower case, properly nested (in order of last used, first closed, such as <x><y>text</y></x>), and require a proper close (the days of the missing </p> tag are over). Non-paired tags, such as the old HTML tags <BR> and <META>, must also be coded to indicate a close. Use the special indicator “/>”, as shown in <br />, to close these tags (the preceding space, which is not required, is often used anyway).


Now that you know why you want to use XHTML document types, you need to declare the proper DTD for it. As stated earlier, the DTD statement precedes the <head> tag. But a bot won’t even get that far if the DTD is not correctly formed. The very first thing in an XHTML file must be the DTD, an example of which is shown below:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

The one shown above, Transitional, allows more of HTML’s presentation features. There are two other types of XHTML DTD statements. You can also use Strict instead if you want super-clean code (you’ll need to use CSS for presentation features, however), or you can use Frameset should you really want to be one of the Internet’s last adherents to frames on a webpage. <snark!>

You’ll also need to modify your <html> tag if you switch to XHTML, which is positioned immediately after the opening DTD statement. In HTML, this tag was typically unadorned with attributes. In XHTML, however, you need to identify the path to the XHTML namespace definition. Use this code for that:

<html xmlns=”http://www.w3.org/1999/xhtml”>

Before moving on, be sure to validate your XHTML pages using a markup validation service and correct any errors you encounter before publishing your pages. You do want that well-formed code that works with any browser, right?

Now that the references for document type and the namespace are set, let’s take a look at what you can do to optimize your webpages from the perspective of the code in the <head> tag. Most of these tags were discussed in an earlier post discussing keyword usage, but the information below on their usage is new.

Title tag

The key message with the <title> tag is still the same. The page title is a critical element for helping the search engine bot identify the contents of your page. The title is usually part of the standard blue link entry for a site in the search engine results pages (SERPs). If you omit this tag or leave the default tag content provided by a template in your development environment, such as New Page 1, folks who eventually find your site in the SERP will hardly be inclined to click your undefined link. And they may have trouble finding you anyway, because you will have missed a great opportunity to associate a few choice keywords and phrases with your page.

When creating the title text, keep the following in mind:

  • The closer the word is to the start, the more heavily weighted it is as a keyword. This is true for the bot as well as the reader. (For information on the affect the Golden Triangle phenomenon of user scanning of a SERP, check out the new Bing white paper.)
  • Keep the title text between 5 and 65 characters in length
  • For greatest efficiency and consistency, write titles using this syntax: keyword phrase, category, website title (or brand)
  • Make the title text unique on every page
  • Don’t use any of the following special characters in title text: ‘”<>{}[]()

Meta description tag

While search engines reserve the right to use a variety of inputs for filling out site description snippets in their SERPs, webmasters who provide unique, concise, compelling, and keyword-laden descriptions in their <meta> tag’s description attribute help guide the development of their websites’ SERP captions.

When creating the description text, remember the following:

  • Create unique descriptions for each page, using keywords specific to that page
  • Keep the description text between 25 and 150 characters in length
  • Do not copy title tag text content as a description; this is a wasted opportunity to develop more keywords and adds no value
  • Make the description text unique on every page
  • Don’t use any of the following special characters in description text: ‘”<>{}[]()

Meta keyword tag

The <meta> tag’s keyword attribute is not the page rank panacea it once was back in the prehistoric days of Internet search. It was abused far too much and lost most of its cachet. But there’s no need to ignore the tag. Take advantage of all legitimate opportunities to score keyword credit, even when the payoff is relatively low. Fill in this tag’s text with relevant keywords and phrases that describe that page’s content.

When creating keyword text, remember the following:

  • Choose words that may be secondary keyword terms (save the primary keywords for use in the <title> and <meta> description tags), and even include a few, commonly seen typographical errors of primary keywords, just for good measure
  • Limit your keyword and key phrase text, separated by commas, to no more than 874 characters
  • Don’t repeat a keyword more than 4 times among the keywords and phrases in the list

Other useful <meta> tag options

There are additional <meta> tags you might consider for your pages if they are appropriate for your target audience. Above all, consistency between pages is key.

Meta content-language tag

If you are directing your website’s contents toward a specific language-speaking audience, you can specify the language of your content using the <meta> tag’s content-language attribute. For example, for a target audience of American English speakers, you would add the following tag to the <head> section of all your pages:

<meta http-equiv=”content-language” content=”en-us” />

You can specify other languages, of course! For information on creating specific language codes, see Language tags in HTML and XML.

Meta content-type tag

You can also choose to specify the content type and character encodings used on your webpages using this the <meta> tag using the content-type attribute. Encoding for text/html content with the UTF-8 (8-bit Unicode) charset is the most common choice used.

UTF-8 allows the browser software to easily map the page’s character encodings to the user’s local language (which is of benefit to foreign language speakers, since Unicode has broad, international character support). An example of a <meta> tag showing the content-type encoded for text/html and UTF-8 is shown below:

<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″ />

For some webmasters who prefer to encode their pages for a specific language character set, refer to the full list of character encoding names registered by Internet Assigned Numbers Authority (IANA) for the appropriate charset attribute code. You can also choose different media types as appropriate.

Meta robots tag

You can choose to limit which pages your site makes available to search engine bots by invoking the Robots Exclusion Protocol (REP) referenced in the <meta> tag’s robots attribute. The details of this topic are extensive, and I will cover this in more detail in a later post. For now, however, you can get a jump on learning how to manage bots on a per-page basis by reading About the Robots <meta> tag. Below is an example line of code that will block a bot (one that adheres to REP) from indexing the content or following any of the links on the page.

<meta name=”robots” content=”noindex, nofollow” />

Link tags

The <link> tag with the canonical attribute, previously discussed elsewhere in this blog, also falls within the <head> tag. It’s used to establish the canonical URL for a webpage (which is helpful for the search engines to know). To see the previous reference to this tag, check out the section Identify the canonical URL for each page in the blog article, Making links work for you. Below is a sample of the code for reference.

<link rel=”canonical” href=”http://www.mysite.com/product.htm” />

Whew! That’s it! I know the articles in this four-part series were exceptionally long, and I applaud you if you got through them all! But all of this is important SEO information for webmasters to know. There’s still plenty to talk about, though, so be sure to come back for more soon. If you have any questions, comments, or suggestions, feel free to post them in our SEM forum. Later…

— Rick DeJarnette, Bing Webmaster Center

Join the conversation

  1. Quality Directory

    This is a good blend of search engine optimization and web designing tutorial. I've always believed that a good way to optimize a site for search engines is to start during web designing phase. And you've given me enough reason to reaffirm my stand.

  2. Ryan IT

    Great Article! Does anyone know if the search engines are currently giving a boost to sites that use XHTML versus HTML? Theoretically this would be an easy way to determine if a site has higher quality content than the competition so it would seem logical. But hey, I don't want to redo my website unless I really have to!

  3. Anonymous

    One thing that is very important is don't go mixing your XHTMLs and your HTMLs. I often end up editing old HTML sites (yuck!) on behalf of people, and it is oh so tempting to drop in the odd <br/> instead of <br>, which in theory will stop their code from validating.

  4. Anonymous

    You given there very important information it's helpful for all thanks for sharing such a quality information about search engine optimization.

    <a href="http://www.pdwebservices.com">SEO, Search Engine Optimization, Search Engine Placement, Search Engine Submission</a>

  5. Anonymous

    i like this

  6. Anonymous

    Information is very useful for me.

  7. Anonymous

    it's a shame there's so much emphasis on the <title> — it's just getting abused like keywords meta tag was, and degrades usability when the title is no longer designed for good navigation in the history list.

  8. Anonymous

    brilliant article this will help on heads tag for seo optimisation

  9. Anonymous

    Does this mean Bing is using the Meta keywords tag in their rankings?

    Also, does the meta language tag affect international searches?  (If I choose french language, will I rank better on bing.fr)

    interesting stuff

  10. jdlepaddy

    Great, it's an useful article! Accurate and complete!

  11. Blackpool UK

    super tutorial for xhtml

  12. Jerzzy Journey boutique

    I hope I did this right I only just finished it !

  13. Anonymous

    Thanks for the very extensive article on SEO and html.  This is very informative tips for our own sites.  Bing is a nice  addition to the internet and I'm glad to have found this community.

  14. MichaelEhline

    What do you guys think about the rel me tags instead of no follow?

  15. jackin

    Great article, useful to seo

  16. Anonymous

    Great post. So your saying that the bots dont really treat xhtml and html differently?

    Ashely :)

  17. awanhendra

    I use WordPress, I have no ability in PHP, anyone can help me..

  18. dropshipping

    Excellent article I am glad I joined the Bing community. I am surprised at the wealth of information here.

  19. luke.sarker

    Good article to help webmasters.

  20. Anonymous

    Great post. Lot of infos I didn't know before. Thanks.

  21. Anonymous

    This is a good list of the head elements. However, I'd like more definitive list of which elements actually "matter" to Bing and/or how each one is weighed in importance (for ranking). Can we have more clarification on this stuff?

  22. Anonymous

    Title Tag!

    You guys should know better than to call the title element a tag! I appreciate the vast majority of webmasters and even SEO's (who should know better) call the title element a tag, but you work for a major search engine, set an example.

    How is Bing treating the nofollow attribute now Google is black holing the link benefit (disappears now!) it was intended to protect?


  23. Free Online Games

    Do you guys use no-follow or is that some google bs?

  24. David Law

    I've been reading the posts under Webmaster blog and it isn't clear if you work for Bing or if this is some kind of community effort where in theory anyone can post?

    Just some of the info I'm reading doesn't sound right: I tend to put most of my time into studying Google (SEO consultant here, 10 years experience) and you NEVER get a Google employee posting useful/accurate information :)


  25. SolarControl

    I thought that XHTML's slow death was recently hastened with the proposal that XHTML V2 development cease and the emphasis be put on HTML 5. Am I mistaken?

    See this page by Microsoft:


  26. Anonymous

    Either my browser isn't working correctly or some people's comments are having the rel="nofollow" added and other's aren't …. Gotta love http://www.quirk.biz/searchstatus :-)

  27. ghostbb8888

    very good articles, just help me!

  28. Anonymous

    Now, where do I start complaining about wasting my time reading this post. First coming from a large search engine it should have been more thought fully written and targeted to a certain audience, main web designers/seo, thus this whole post could have been more concise… my main concern here is how you go ahead glorifying XHtml against HTML and stuff that happened in 2000, wakey wakey… we are in 2009, and the world is changing HTML 5 is the new buzz… XHTML2 is over man… how about put some clarity on those things for an heads up!!

  29. Anonymous

    Are you guys planning on coming up with a "Bing Analytics" any time soon?  It'd be nice to not have to rely on $oogle for our analytics.

  30. jamesandrew

    Useful article!

  31. Anonymous

    Very usefull to Seo Work. Great Article !!!

  32. spc702

    Very detailed info! I'm going to review my site and see what I can apply ….. i think mine is still html format:(

  33. Anonymous

    great article on setting up a web page.  I actually learned more in this article than I have in reading many books.

  34. Anonymous

    thanks for information.

  35. s2_krish

    Very nice! thanks

  36. Anonymous

    "Make the title text unique on every page"

    Why does this blog use the same title for each post page?! ("Bing Community")

  37. Anonymous

    Watch out….. It seems like Bing Team knows what they're doing.

    Only one question before taking over Yahoo – Where would we be able to search for backlinks if you turned off the option and you're taking out Yahoo ?

  38. karadagli_61


  39. Anonymous

    This is an excellent write up om how to optimize the "head tag". I have abandoned the idea of using meta description and keywords primarily due to the fact that other search engines do not appear to give as much value as it used to. Nevertheless you are right when saying that we should take this opportunity even if the payoff is low. This only means that regardless of the value, it has some and that is good enough for me to pout it back. Thanks and I will have to back track here to read all previous post. While I am no SEO guru, I have been always fascinated by it.

  40. Anonymous

    Very Good SEO Tips.

  41. zhangmin_iichiba

    Great article! these tips are helpful for webmasters

  42. rohittripathi60

    yes it such a nice article

  43. Anonymous

    What do you guys think about the rel me tags instead of no follow?

  44. seanp9711

    Appreciate the thought and energy put into this. Thank you.

  45. Anonymous

    This is a great article, thanks.

  46. Anonymous

    Very good article. I learned a lot from this. Many thanks,

  47. Anonymous

    Nice article. Thank you !

    When yahoo and Bing get together, what will happen to the yahoo paid advertising? Will it be shown in Bing too?

  48. salil_2000

    Great article, useful to seo

  49. Anonymous

    hi! It's a simply super… Thanks for the sharing….

  50. miles2go

    Awesome article , Most new webmaster missed it and don't give importance.

  51. Anonymous

    Keep up the good work. I'm glad that the Bing Webmaster Blog is so active. We really appreciate that

  52. Andreas Pfister

    This is exactly the kind of article SEOs and Webmasters need. Thanks!

  53. Anonymous

    Almost all the comments on this post are people who are obviously trying to grab Bing's link juice with a link to their <pejorative adjective deleted!> web sites.

    So, Webmaster Central Team, would you care to comment on how the search engines indirectly cause blogs to fill with junk?  And what we can do about it?  I'd like to have a robots.txt directive to not index comments.

  54. brianllama

    "To cut to the chase, HyperText Markup Language (HTML) is so 20th century! The World Wide Web Consortium (W3C), the official body that manages the Web by creating public standards and guidelines, long ago determined that HTML was a limited-use language"

    Oops. Not so much.

    From http://www.w3.org/MarkUp/Activity.html

    "We can expect a reorganization of the Activity within the next 6

    months. Discussions about rebranding the work around XHTML2, or evenstopping the work, will be on our agenda.

    The situation in the HTML Working Group will continue to be

    monitored and we have a full confidence in the co-chair abilities to continue to build support and consensus around the HTML 5 specification."

    Looks like HTML 5 is the future of webpages. XML is the future of file formats and data storage.

  55. alan_ie

    unfortunatly bad advice re: xhtml vs html

    as their own browser still cannot parse proper xhtml

    {ie xhtml served with the correct mime type of application/xhtml+xml}

    {it will only offer save-file dialog}

    but will show it if incorrectly served with wrong mine type of text/html

    while all other browsers will show both they will render xhtml as html only if not served with the correct mime type

    so you can either

    A hack the server to lie about mime type to IE only

    B lie to all and have xhtml render badly in good browsers

    C sick to HTML 4.xx strict and have all browsers work as expected till IE has xhtml support

  56. bryangrandy

    Very glad I found this article, I'm blogging about it this month and needed to know where Bing stood on the keywords issue.

  57. robferraro

    Very good reading…

  58. oliver_schmidt_

    An additional information: In HTML5, the doctype is defined as <!DOCTYPE HTML> and there will be only that one doctype. Looking forward to IE9 which will support HTML5.

  59. chris.doonit

    Thanks for the such information…As tags plays a big role in on page optimization or we can say to make our site popular…so the information provided by you of the html and xhtml is quite useful.


    for Online Computer Support, Contact http://www.askpcexperts.com

  60. timdunton

    Great article, many thanks

  61. asiveengin

    thanx you

  62. irfanullah.jan

    Thanks. I am using XHTML Transitional.

  63. Nakliyat

    Where can ı learn all the tags

  64. Harshad Patel

    there are good information about header optimization.

  65. Jon12

    share the good know every need the same for seo work?

  66. tw_ec_seo

    Does Bing support canonical tag?

  67. www.ticsoft.com

    Bing is a nice  addition to the internet and I'm glad to have found this community.

Comments are closed.