Thursday, August 21, 2014

iFrame alternative for Navigation Bars for SEO

I've been researching search engine optimization for Game 103 recently, and it seems that iFrame links are not as good as links built into the page. However, it can be a hassle to keep navigation updated without an iFrame. The alternative? Using server includes.

On your html pages, you can use this tag:



In the case above, navbar.html is stored at the root directory of the website. You can add to the path if your navbar is located somewhere else.

On your php pages, you can use this tag:



If the php page you are editing is not in the same folder as your navigation bar you'll have to navigate there. This is a little different with php than in html. You can use this code:



This navigates to the root and then to the navigation bar.

Here's some links to articles that I read to get the includes working on my site.

http://www.htmlgoodies.com/beyond/webmaster/article.php/3473341

http://www.w3schools.com/php/php_includes.asp

http://css-tricks.com/php-include-from-root/

James Grams