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!
How to Setup a SEO friendly 301 Redirect
301 redirects are used to tell the browser that the page they are requesting has been moved permanently to another location. However, this is often used in SEO as well to give a domain ALL the credit from incoming links.
Search engines see your domain as 2 domains.
http://www.mydomain.com
and
http://mydomain.com
If 50 sites link to www. and 50 link to mydomain.com, you are losing half the 'votes' for your website (a link to your site is essentially a vote that your website has good content). The best way to get FULL credit for your links is to setup a 301 redirect.
Log into your hosts control panel and look for a Redirects option.
Type of Redirect: 301 (Moved Permanently)
Select the domain from the dropdown list.
WWW Redirection: Look for an option that says Only redirect with www.
Redirect to: Type http://mydomain.com
Click add.
If you visit http://www.mydomain.com, you should now be redirected to http://mydomain.com. Alternatively you can set this up so that any request to http://mydomain.com redirect to http://www.mydomain.com, this is up to you.
One last thing use this: SEO Friendly Redirect Checker to make sure your redirect is setup properly! For Example, i can check this site for a redirect by typing http://www.theinfiniteblog.com, it will tell you there is a search engine friendly redirect setup!
If you do not have a host or they do not support configuring redirects, you may have a little more trouble setting up the redirect, BUT, there is a great resource for setting up 301 redirects with: IIS, HTAccess, PHP, ASP, etc etc.
How to Redirect a Web Page
Happy Redirecting!
Comment if this helped!
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
Adding/Insert Line Breaks into a Textarea
Seems like a simple enough problem to solve...just use \n or a br tag
right? ...wrong.
This markup <textarea>Test<br/>Newline</textarea> produces:
And the markup <textarea>Test\nNewline</textarea> produces:
The trick to inserting a new line is to use the character for a carriage return. I stumbled upon this when I ran into this problem. I opened a new notepad file and made a simple textarea. When typing in it, I noticed that when I press enter it goes to a new line (obviously), so I figured why not try to put a carriage return into the textarea. The carriage return representation is .
So the markup <textarea>Test Newline</textarea> produces:
And there you have it, simple problem to which the answer may take 30+ minutes to find.
Hopefully I save you that 30 mins ![]()
Comment, Enjoy ![]()
Centering a Div in IE
Little quick tip. This is mentioned in my basic css layout tutorial, however, im making a seperate blog post, because it is important. If you have a div and you want it centered, you may do this with margin: 0 auto, applying auto margin to left and right. This doesnt really work in IE.
If you are trying to center your container or wrapper div, this is how you do it.
Problem: IE doesn't properly center a wrapper or container div.
Reason: IE actually uses text-align to center block level items as well as text.
Solution: The solution is to apply text-align: center to the body tag, and offset this in the wrapper div.
<div id="wrapper">
</div>
And the css:
body{text-align: center; /*centers in IE*/}
#wrapper{
text-align: left; /*offset the ie center*/
margin: 0 auto; /*centers in other browsers*/
}
Enjoy.
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.
Alternating Table Row Highlights using JQuery Tutorial
Hey, quick and short article here, but nice effect.
Anyways, a lot of tables on the web have alternating row colors, and this is a nice effect.
But when you have a table with over 100 rows, adding a class="rowhighlight" to every row just does NOT
make sense.
Assuming you already know JQuery, here is a quick and easy way to apply row highlights.
In your css file, define a row higlight class and color.
.rowHighlight{background-color: red;}
Ok, done ![]()
Now, in your jquery.scripts.js, or whatever js file you have document.ready() in, add this function.
$("table.hilites tr:odd").addClass("rowHighlight");
What this does is add the class "rowHighlight" to every odd row of a table with the class hilites.
<table class="hilites">
<tr><td>This will be red</td></tr>
<tr><td>This will be default</td></tr>
<tr><td>This will be red</td></tr>
</table>
You can also define a .rowHighlight2 and write this jquery function.
$("table.hilites tr:even").addClass("rowHighlight2");
.rowHighlight2{background-color: blue;}
Any table with the class highlight, will now alternate red and blue rows! ![]()
Obviously, pick a color that suits your site.
This technique is REALLY easy, but gives your site a more professional look.
Enjoy
