Google SEO Flash & Flash Tips/Techniques
Google SEO Flash
Google currently DOES index flash, however, I believe it is extremely unreliable. Clients have asked me to do some SEO work on their sites, little did I know, these sites were flash!
Most crawlers seem to have a hard time crawling flash and the #1 tip I can give for Flash SEO is: don't show search engine crawlers flash, show them alternate content!
The reasoning behind this technique:
1) Underlying HTML Content
2) Use javascript to load Flash
3) GoogleBot = No Javascript = Doesn't see flash, sees alternate content
For two of the sites I have worked on, I have used JQuery, JQuery SWFObject Plugin, and a base HTML site to get these sites indexed. Search engine crawlers do not have javascript, so we will use it to load our flash. If our client has flash and javascript, our client will see Flash. If they dont (Googlebot doesn't have Javascript) they will see our underlying HTML content. Let's take a look at this code:
<div id="flash"></div>
<div id="altContent">
<h1>Google SEO Flash Tips and Techniques</h1>
<h2>How To SEO Flash for Google</h2>
</div>
On your main page, write <div id="flash"></div>, then wrap your Search Engine Optimized code in <div id="altContent"></div>.
As you can see, the content in the "altContent" div, is pure html which we can apply the following Basic SEO Techniques to. We have an empty div above with the id "flash". We will use JQuery & the SWFObject to load our flash file into our "flash" div. Since the flash loading is done using javascript, Search Engine Crawlers will not see the flash, but will see our optimized HTML content.
Download a copy of JQuery here: http://docs.jquery.com/Downloading_jQuery
and SWFObject plugin here: http://jquery.thewikies.com/swfobject/downloads
We will put all our files in the same directory for simplicity, you can put them in a seperate 'scripts' directory if you want to keep organized.
On our main page, we will add the script references (order is important! first load jquery, then the swfobject plugin):<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.swfobject.js"></script>
Now, underneath this, we will add the function to load our flash file:
- <script>
- $("document").ready(function(){
- if($.flash.available){
- $("#flash").flash({
- swf: 'main_flash8.swf',
- width:766,
- height:750
- });
- $("#altContent").css("display", "none");
- }
- });
- </script>
This code should be pretty self explanatory, but, let me explain:
Line 2: We are setting up a function to run when our document has been loaded.
Line 3:Check that the user has the flash plugin and it is enabled
Line 4: We are using the .flash() method of SWFObject to load content into the #flash div. (# stands for id . stands for class)
Line 5: We set the swf: parameter to our swf file
Line 6/7: We set the width/height
Line 9: Now that our flash has loaded, we set the display of the altContent div to none, which will hide it.
Since GoogleBot does not have javascript, the code to load the flash and hide the altContent will never run.
If a user has flash, the flash site will load. If not, they will see the html content.
Searching for my clients business name, they could not be found anywhere. Once I applied the technique above, they were #1 within a week (Search engines do take some time
)
This technique is widely accepted. For some more reading, check out: Google Does Index Flash
Hope this article helps.
Comment if it did!
Professional Table Styling using CSS
On this blog, I have a post about using jquery to apply alternating table row coloring. Someone commented that they couldnt quite get it working and needed an example. So, while making the example for him, I figure it would be a good post to show how to style a table professionally with CSS.
So, were going to start with this markup:
Note: You only need to load jquery and jquery.scripts if you want to do the last part of this example.
<html>
<head>
<title>Table Row Coloring Example</title>
<script type="text/javascript" src="jquery.js"></script> <!--load jquery-->
<script type="text/javascript" src="jquery.scripts.js"></script> <!--load our custom jquery file-->
<link rel="stylesheet" type="text/css" href="style.css"/><!--load our css styles-->
</head>
<body>
<table>
<th>id</th>
<th>First name</th>
<th>Last name</th>
<tr><td>1</td><td>Scott</td><td>Moniz</td></tr>
<tr class="row2"><td>2</td><td>Bob</td><td>Barker</td></tr>
</table>
</body>
</html>
Alright, now that we have that done. We area going to create style.css and add a few rules.
Here is the table selector:
table{
border: 1px solid #ccc;
}
well....that doesnt look very good..YET.
Lets add a rule to the header. We'll add a background color.
table th{
background-color: #ccc;
}
Lets add a rule to the table data tags.
table tr{
border: 1px solid #ccc;
}
Now, lets see what we got so far.
Not too bad. You'll notice the headers are a little to close, and the borders dont look too great. Don't worry well fix that. Lets add another couple rules to table th and td.
table th{
border: 1px solid #000;
padding: 5px;
}
table td{
padding: 2px;
}
Alright..lookin good so far. Here's what you should have:
Lets take care of these ugly borders.
On our table selector we will add this rule:
table{
border-collapse: collapse;
}
If you look at the table, you'll notice that on the 2nd row there is a class="row2". We will now style that class.
table tr.row2{background-color: #EBEBEB;}
DONE. The final result looks like this.
You can always modify the styles as you wish.
Tip: Every 2nd row, add the class="row2" to the row to get the alternating row colors. Optionally, add text-align: center; to the table selector.
Here's the full CSS:
table{border: 1px solid #ccc;border-collapse:collapse; text-align: center;}
table th{background-color: #ccc; padding: 5px; border: 1px solid #000;}
table td{border: 1px solid #ccc; padding: 2px;}
table tr.row2{background-color: #EBEBEB;}
Keep reading for an easy way to alternate row colors when you have a lot of rows.
Alright, now, if your table has 20 rows, maybe even 50, or 100, adding row2 manually is really a pain...and I personally wouldn't do that. We will use jquery to color the alternate rows.
Find the <tr class="row2"> and change it to <tr>. If you load the table you'll notice the alternate rows aren't colored anymore. We will now add a class to the table. So <table> should look like this <table class="altcolor">.
Now that our table is setup, we will use a jquery selector to color rows in any table that has the class altcolor.
You should have jquery.js and you should create a file named jquery.scripts.js.
Open jquery.scripts.js and add the following:
$("document").ready(function(){
$("table.altcolor tr:even").addClass("row2");
});
This loads when the webpage is ready
//Notice the selector ?
table.altcolor tr:even means any even row, in a table, that has the class "altcolor"
Now we just call addClass, which will add the class row2.
now, the class row2 is added to every even row in a table with the class altcolor.
Done.
If you don't get the same result, you might want to download the example source and check it out.
Download Table Styling Example
Tip: When using jquery to style alternate rows, check your table with javascript disabled.
For example, if you style your tables to have white text, and your row2 is supposed to apply a dark background to make the white text show up, if they have javascript disabled, they won't see the white text. Be careful and make sure your table looks good with and without javascript.
Easy Javascript Validation using JQuery
Now, there might be other tools out there, but this is how I do mine. I like to write stuff from scratch but I actually feel like this little script would make life easier for a lot of people. You're free to use this as long as you leave the copyright in there.
First download jQuery and this script: jquery.validator.js (Right click>Save As)
Next, add these lines.
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.validator.js" type="text/javascript"></script>
When you create your forms create them like this.
The form must have an id, and it must have the class "validate".
Add the class 'req' for any fields that are required.
Coming soon: email, int verification, age, etc.
<form id="contactform" action="whatever_action_you_want.php" class="validate"> <input type="text" name="firstname" class="req"/><span class="val">*</span> <input type="text" name="lastname" class="req"/><span class="val">*<span> <select name="country req"> <option value="">Please select</option> <option value="CA">Canada</option> </select> </form>
In your css add these
span.val{visibility: hidden; color: red; font-weight:bold;}
Thats it.
If you guys post comments and subscribe, I can let you know when i further develop this. It will include number verification, email verification, postal code verification. It's very simple and lightweight and will shave time off any project. File (Right click>Save As): jquery.validator
Using javascript to opening a new window W3C Validation target="_blank" alternative
<a href="http://www.google.com" target="_blank">Google!</a>
Perfect way to open a new window right? WRANG! (End of the world flash reference ...look it up)
Your webpages may not pass W3C validation because your still using target="_blank".
This article will show you how to use javascript or jquery to open a new window, and have your webpages pass W3C Strict Validation.
Anyyyyyyyyyyyways, using the target attribute of the a tag was a perfectly valid way of opening a link in a new window. However, this currently does not pass certain XHTML Validations. I assume you found this blog post because you need to validate and target="_blank" isn't passing.
This solution will open your link in a new window.
<a href="http://www.google.com" onclick="window.open(this.href);return false;">Google New Window!</a>
What this does is use window.open, and passes the links href attribute as the url.
The reason for "return false", is so that the base web page does not open the link as well.
Another cool alternative is to use JQuery...ya I know this is javascript but if you have jquery already loaded you can add this to your document.ready function.
$(document).ready(function(){
$("a.newWin").click(function(){
window.open($(this).attr("href"));
return false;
});
});
<a href="http://www.google.com" class="newWin">Google</a>
Any link with the class newWin will now open in a new window.
Both these methods validate to XHTML Strict and are easy to implement.
Enjoy.
