Category: server side includes seo

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:

<!--#include virtual="/navbar.html"-->

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:

<?php include 'navbar.html';?>

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:

<?php $path = $_SERVER['DOCUMENT_ROOT'];
$path .= "navbar.html";include_once($path);?>

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

Posted in iframe alternative for html, iframe alternative for php, seo navigation bar, Server side includes navigation bar, server side includes seo

1 comment