Posts Tagged ‘web pages’

Does it matter what order you put header tags in?

I was surfing YouTube today and came across a great video from Matt Cutts (the Guru of Google) who answered an interesting question, does it matter what order you put header tags in?

 

What I find most interesting is Matt’s body language in this video, especially when talking about how Google tries to make sense of poorly written websites. Yes, they do their best to do it … but let’s all still try to help (Document Structure vs. Document Appearance, the power of CSS). 

So what do I get from his comments?

For those of you who don’t know who Matt Cutts is, he’s well known in the SEO community as the face of Google, which I guess is pretty impressive really. He offers a lot of advice on how to make websites more friendly and is pretty well the Oracle when it comes to what Google likes (and doesn’t like).

So here’s what I took from Matt’s video

  1. Google tries really hard to read your web pages, even if you’re technically incompetent. Does this mean that you shouldn’t try to optimize your pages? Not at all, but writing quality content is what Google really hopes to find.
  2. Google understands that content formating mistakes happen.  Sure, we should all strive to be perfect but let’s remember what’s important (content!)
  3. Google’s Offices need longer blinds. Hey, I’m not judging … maybe shorter blinds have a better SEO value?

As always, I think anybody who wants to have an online business should take a few minutes at subscribe to the Google WebMaster YouTube channel.

How to build a free website

There’s a secret that many web designers don’t want you to know, it’s that there’s no cost to building a website. In fact, you don’t even need special software to do it, everything you need is already installed on the most basic computer available today. In order to build a website, here’s all that you need:

  • On a Windows computer – NotePad
  • On an Apple Macintosh – TextEdit

textedit 300x281 How to build a free website imageNow that you have all the tools that you’ll need to build a web page, you need to understand a few things about building web pages.

How to Format a Web Page

Web pages are divided into two specific areas, the <head> and the <body>, each of these two areas does something specific and before you can build a web page, you need to understand the basic purpose of each section.

Setting up Your First Web Page

basic html How to build a free website imageFor a web page to be recognized by a web browser (the software application used to view a web page) we first need to tell the browser that our document is an HTML document. To accomplish this, all we need to do is place the code <html> on the first line of our document followed by </html> on the very last line of our document.

Once those tags are in place, most web browsers will understand that the content being displayed is an HTML document. I say most because technically, there is a bit more that you should put in there if you want to ensure the site is 100% compatible with all modern web browsers, but explaining the fine details of DOCTYPE structure is a little beyond the scope of today’s tutorial. Needless to say, placing the tags <html> and </html> will tell web browsers what your document is but if you’d like to technically perfect, place the following code instead:

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

Once that’s done, remember that all other code must be placed between the two <html> tags to be recognized as valid HTML.

The <head> Section

The <head> tag of a web page is the reserved for things which other computers and software applications require to understand your web page properly. For example, when a web browser loads your web page there are specific things that it looks for in order to understand what language your site is in, what your web page is about and the name of your page. Within the head section, we want to include details such as:

  • Links to alternative content such as RSS feeds, XML site maps and mobile interface files
  • Javascript links and or content to help the functionality of our page
  • META data for robots to read including a page description, keywords and generator
  • Cascading Style Sheet (CSS) details or links
  • The document content type
  • Codes and robot commands for foreign applications
  • Pingback processing directives
  • The web page icon file location
  • Canonical labels for search engine optimization
  • Base directory directives
  • The title of your document

Sounds like a lot right? Well it is, and it’s all very important stuff. Essentially, the <head> section of your web page stores all the mechanical and client side information required to properly index, label, categorize and distribute your web page as well as the information needed to successfully display your web page in a users browser. I could write a whole post on each of the items above but for now, it’s simply important for you to know that the <head> is used to store those pieces of information and you can add them at a later date.

html with head How to build a free website imageAdding data to the <head> of the document is done the same way as all elements of an HTML document, by opening and closing an HTML tag. In this case, the <head> tag must be opened and later closed </head> in order to store the appropriate content. Between those tags, you may store a series of HTML or xHTML (we’ll talk another day about the differences) data devices for use in rendering your pages. For example, here is a basic <head> element for a common web page:

<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>Untitled Document</title>
</head>

You will notice that in this basic example we only store the basic information required to make a web page work, the http-equiv which tells web browsers that the document being served is in text/html format (as opposed to text/rtf which is a Rich Text document or text/javascript which would be a JavaScript file) so that the web browser looking at this document understands it is an HTML page. untitled document How to build a free website imageAdditionally, the <head> contains the <title> tag which closes (</title>) after labeling the document Untitled Document. If you loaded the source code into a web browser, you would now see a blank document with no content displayed to the user but a new title at the top of your browser, labeled Untitled Document. This document title is the label being fed to the web browser from the <title> tag contained within the <head> of this document.

The <body> Section

If the <head> of a web page is the content being presented to other computers, then the <body> is the content being displayed to human eyes (or text readers) visiting your web page. Creating content on a web page is wonderfully simple. If you’d like to have a web page say hello, simply add the code:
<body>
hello
</body>
html with body How to build a free website imagePresto! You now have a fully functional web page, albeit a little dull. The <body> section works by displaying exactly what you type as content, so anything (and everything) you add between the two <body> tags will appear on your web page but you have to be careful, HTML needs the content marked up (labeled) to be properly viewed in a web browser. Just in case you didn’t know, HTML stands for HyperText Markup Language, a Markup Language is simply text that’s been formated to be read by computers. For example I can create my own Markup Language right now called Chris Ross’s Markup Language (CRML) that looks like this:
[-open-]Hello World![-close-]
Now I have my own Markup Language but since nobody uses it, it’s pretty much useless. On the other hand, everybody with a web browser uses the HyperText Markup Language (HTML) so let’s look at it. HTML has a handful of common codes used to display content effectively, they are:
  • <p>, always followed by </p> which displays text in paragraph format
  • <br>, which never has a </br> but instead is written <br/> in xHTML and represents a line break (where a paragraph is often displayed as two line breaks to separate content)
  • <ol>, which always needs a </ol> for ordered lists (numbered lists) and <ul> with a </ul> for unordered list (bullets), both also require <li></li> tags for each list item in the list to work
  • <b></b> or <strong></strong> tags mark text as important. The <b> tag was replaced with the <strong> tag a few years back since not all languages bold words to make them more important
  • <i></i> makes a word italics but like the <b> tag, was also replaced. These days, you can use <em></em> to place emphases on a word or phrase
  • <h#> tags are special and always need an corresponding </h#> tag where the # symbol can be replaced with the numbers 1 through 6 (<h1>,<h2>,<h3>,<h4>,<h5>,<h6>) which represents the level of a header in your document
  • <img /> will allow you to place images in your document but requires special parameters we’ll talk about another time
  • <a> followed by a </a> tag will hyperlink the text between the tags to another document but also requires special parameters.
  • <table> tags can be used to display tabular data (like charts) on a web page. It needs to end in a </table> tag and can include headers (<th></th>), rows (<tr></tr>) and columns (<td></td>). Why columns are <td> is beyond me, but that’s what they are.
  • <div> tags use a closing tag of </div> to divide content into various areas of a page, much like the <span> tag, the <div> tag has no visual effect on content but is used by programmers and designers to affect content.

Essentially, the ten tag structures above represent the HTML code found in every single web page on the planet. There are other tags, but have either been replaced or are simply bad tags. For example the <u></u> tag will underline content and the <blink></blink> tag is simply wrong … even the creator of the tag, Lou Montulli (it’s odd to think somebody actually invented a tag eh?) appears to wish it would simply die.

When put together, the <html> document label tells a web browser the information is a web page, the <head> indicates content reserved for other computer systems to read, while the <body> shows content to the end user.

In total, the 26 tags here represent the whole of the content required to build your own web site for free. If you’ve found this post at all useful, please feel free to leave me a comment below, thanks for reading.

SEO News Worth Watching

Search Engine Watch pointed to Bill Slawski’s latest patent find, an application by Yahoo entitled Automated System to Improve Search Engine Optimization on Web Pages. For anybody interested in organic marketing trends, all three of these articles are a must read.  There’s another piece at Yahoo Plans to Automate SEO that summaries much the same thing.

Avoiding SEO mistakes is pretty easy these days as long as you follow some basic guidelines but where oh where can you gain access to these oracles of knowledge? Frankly, I’d start by reading the Google SEO & Quality Guidelines and Yahoo SEO Guidelines. After you’re done that, take a look through my own blog here or pop over to read Blog SEO Tips: Top SEO Mistakes to Avoid and Basic SEO Tools for Real Estate.

My article yesterday about Improving your SEO with Site Maps will be able to walk some of you through the simple art of WordPress SEO and you all should check out the new contest I’ve posted for this month, with three great prizes for all of you!

Google is Changing the Way SEO is Played

It looks like there’s going to be a new sherif in town guess who’s going to be holding the keys to the jail? You. That’s what it look like if Google’s new preferred sites experiment gets off the ground. This is a feature I’ve been hoping for since I first came across a PHP advice website (which will remain nameless). Basically, if the posts are to be believed, Google will allow us to start ranking which websites we prefer to get results for and hopefully, which ones we want to banish to the lower rankings of the SERP’s.

Traditionally, search engine result pages are controlled by a combination of complex algorithms which result in higher ranking (PageRank) web pages appearing at the top of listing while lower ranking websites appear at the bottom. This of course can lead to highly skilled web designers pushing up unrelated results with a focus on promoting their own websites over valid content. What Google has done (at least on a test scale) has allowed users to prefer content from one website (the imbd for example) over other less known websites.

It’s a pretty big assumption but knowing Google’s track record of priding itself on being a forward facing, client focussed web tool I am confident in predicting that Google will be slanting all search results with the data collected from the few active participants. With luck, combining the data with the existing PageRank system will give Google the ability to select with a greater accuracy quality websites.

The process is a little bulky at the moment, users have to register for a Google account and then log into their account and change settings. Hopefully, with a little bit of time this system can be boiled down to something as simple as a method of simply excluding sites on a results page. I dream of the day that I can banish some of the high PR, low quality websites (not me … please, not me) to the basement of results.

(For the record, my wife thinks that I should have gone with my original title which was … This is Truly Orgasmic in a Googley Kind of Way … what do you think?)

Automatically Title Casing Titles in WordPress

If you’re anything like me, you’re a little lazy when it comes to title casing text in WordPress but as we all know, it’s really important to be consistent across your web pages, so what’s the answer? As I often comment … it’s time for technology to come to the rescue.

Using a simple code snippet I came across on Camen Design, you can easily add a small function to your website, which in turn will automatically convert all your headers to a consistent format.

Start by inserting the following code in your header.php file:

function titleCase ($s_title) {
	//remove HTML, storing it for later
	//         html elements to ignore  | tags  | entities
	$regex = '/<(code|var)[^>]*>.*?<\/\1>|<[^>]+>|&[^\w]+;/';
	preg_match_all ($regex, $s_title, $html, PREG_OFFSET_CAPTURE);
	$result = preg_replace ($regex, '', $s_title);

	//break by punctuation, find the start of words
	preg_match_all ('/[\w&`\'‘’"“\.@:\/\{\(\[<>_]+-? */', $result, $matches, PREG_OFFSET_CAPTURE);
	foreach ($matches[0] as &$m) {
		//find words that should be lowercase
		if ($m[1]>0 && mb_substr ($result, $m[1]-2, 1) !== ':' && preg_match (
			'/^(a(nd?|s|t)?|b(ut|y)|en|for|i[fn]|o[fnr]|t(he|o)|vs?\.?|via)[ \-]/i', $m[0]
		)) {
			$m[0] = mb_strtolower ($m[0]);

		//brackets and other wrappers
		} elseif (preg_match ('/[\'"_{(\[]/', mb_substr ($result, $m[1], 3))) {
			$m[0] = mb_substr ($m[0], 0, 1).mb_strtoupper (mb_substr ($m[0], 1, 1)).
				mb_substr ($m[0], 2)
			;

		//both of these cases are no change, thus if not matched fall back to capitalisation
		} elseif (!(
			preg_match ('/[A-Z]+|&|[\w]+[._][\w]+/', mb_substr ($m[0], 1)) ||
			preg_match ('/[\])}]/', mb_substr ($result, $m[1]-1, 3))
		)) {
			$m[0] = mb_strtoupper (mb_substr ($m[0], 0, 1)).mb_substr ($m[0], 1);
		}
		//substitute the change into the title
		$result = substr_replace ($result, $m[0], $m[1], strlen ($m[0]));
	}
	//restore the HTML
	foreach ($html[0] as $tag) $result = substr_replace ($result, $tag[0], $tag[1], 0);
	return $result;
}

Next, you’ll need to do a search and replace your entire WordPress theme directory for the current title tag (<?php the_title(); ?>) and replace it with the new tag (<?php echo titleCase(the_title(”,”,FALSE)); ?>). As always, be sure to backup your code before doing this. What the new code has done is told WordPress to insert the title as variable instead of displaying it. Once stored in memory, the titleCase function is called and does it’s job of standardizing the text.

I found a few other really good resources for title casing in PHP in SitePoint and WeberDev but the PHP resource for UC words was one of the best, albeit a little technical, with a little bit of PHP knowledge you should be able to modify the code to work with most CMS applications. Make sure to read about speeding up WordPress however, as this function will certainly add to the server load of a popular website.

Simple tricks to speed up your WordPress website.

WordPress is a great tool but for those of us on shared hosting it’s important that as our web traffic increases we look at ways to decrease the amount of stress our sites put on the web server. I found a couple of wonderful suggestions on Lorelle’s website and I’ve added a few of my own.

There’s a couple of reasons for this, first we want to make sure our web pages load as quickly as possible but as importantly we want to ensure our website stays online. There are countless stories on the internet about websites that suddenly found themselves very popular and struggled to keep up with the traffic, only to have their account temporarily shut down by the hosting company.

WordPress is written in PHP and uses a MySQL database to serve up content. This is great except the content on your website doesn’t change all that often so why are you dynamically generating it for each visitor? Instead of rebuilding the xHTML for each visit, why not serve them a previously saved version? We call this caching a website and it can be done with the wp-cache plugin from Ricardo Galli Granada.

So the first step to increased speed of your WordPress website is to download and install the WP-Cache plugin. It allows you to set how many seconds between page caching as well as if any specific files should never be cached. Very handy. You should also make sure you’re on a reliable web host who can handle the traffic.

Diggproof & Speed up Your Wordpress Blog has a great and often overlooked suggestion. Upgrade your WordPress blog. This might sound silly but generally speaking the latest code releases for WordPress are stable and optimized, so taking a little bit of time to upgrade your site during each release is a solid idea.

Unused plugins can kill performance so before you go installing and forgetting about your plugins, make a habit of deleting unused plugins. Some people might assume deactivating them is good enough but personally I prefer to delete them.

Using a tool such as phpMyAdmin take time once a week to optimize your MySQL tables. If you don’t have access to phpMyAdmin, execute the following SQL statement from your command line to make sure your tables are in the best shape possible:

OPTIMIZE TABLE `wp_comments`, `wp_links` , `wp_options` , `wp_postmeta` , `wp_posts` , `wp_ratings` , `wp_terms` , `wp_term_relationships` , `wp_term_taxonomy` , `wp_usermeta` , `wp_users` , `wp_wpsb_users`

Arne has some great suggestions for MySQL Query Cache and PHP Compiler Cache options, they’re pretty technical but well worth it if your running into significant server speed issues. If you’re technical, give this article on how to configure Apache a read as well, it will help you optimize your whole site.

Paul Stamatiou makes a great point by writing “Every HTTP request, or loading each item on your website, has an average round-trip latency of 0.2 seconds. So if your site is loading 20 items, regardless of whether they are stylesheets, images or scripts, that equates to 4 seconds in latency alone“. So, take a good long look at your theme and determine what you really need in there. I saved a ton of time per page load by stripping out over 20 JavaScript calls and replacing them with PHP scripts which are cached once every five minutes. I also combined all my CSS files into a single file which decreased the number of HTTP requests my server had to take. Paul also have a great article on Compressing CSS with PHP that you should read if you still need to speed up your site more.

There’s another great suggestion from WPCandy that I’m extremely reluctant to do, but I know they’re right. First, use shorthand CSS so:

#commentarea li {
margin-top: 10px;
margin-bottom: 10px;
}

should become:

#commentarea li {
margin: 10px 0px 10px 0px;
}

You should also decrease whitespace (that’s the empty space between tags), sure it makes it look better but it also takes up bandwidth.

Finally, decrease your overall database calls. WordPress gives us all sorts of great functions in our templates but really do you need to call the website name from your database? The simple answer is no, so let’s decrease the over all number of MySQL queries by optimizing our templates. Replacing with your title for example will help decrease the server load.

I hope this helps, if you have any other suggestions for how to optimize WordPress and speed up the site please let me know.

Better HTML Helps Search Engine Results

For the best search engine rankings, you need to understand (and accept) that search engine robots (sometimes called spiders) are not as clever as people, so it’s important if you’re looking to have your website listed on search engines that you speak the same language they do. By language, I mean HTML, xHTML and CSS. Writing valid syntex helps search engines understand the code on your site and in turn, list you effectively. This can greatly increase the traffic your website receives from search engines with very little investment.

Writing valid HTML code will also have the side advantage for rending in visitors browsers better, faster and without errors. Everybody likes a websitet that words, so instead of driving away traffic you can follow some simple tips to improve both the number of people how visit your site and the amount of time they spend on it.

Modern HTML editors such as Adobe Dreamweaver do a great job of building better websites but they still have some problems writing clean web code, once you’ve completed your website pop over to the W3C Validator and test your website. This will tell you how easily search engines can read your website. Remember, a single error can cost you the difference between being on the first page of search results or … somewhere else.

Remember, coding web pages isn’t easy and doing it well is even harder but it takes practice and eventually you’ll pass the W3C’s tests. Sometimes it takes me hours to get a simple page past their inspector, but it’s worth it in the end.

Making Images Print Friendly

Aaron Gustafson has produced a wonderful article on replacing web images with images suitable for printing, the iIR: img Image Replacement method allows web designers to create pages which look great in both web and print.

Using Aaron’s method, designers should be able to create and maintain websites viewable on multiple devices without having to deploy multiple versions of the site. This will allow users to access the same website via an iPhone, a Wii, a laptop or a printed version and have graphics on the page served to meet their specific needs.