views:

559

answers:

2

I have some web site. There are some pages rendered using iframes to show page content instead of flat regular page. The reason is that before and after my content I show header and footer (some logo + basic html) of some other sites, which I can't change, and use iframes to prevent css problems (when header's and footer's css will override css from my pages). The problem is SEO: search engines don't like iframes. How can I solve this problem?

Example:

I have site: www.site1.com where all pages are flat (without iframes).

Also there is www.othersite.com, which contain:

  • [Header]
  • IFrame[My content]
  • [Footer]

and I have full access to www.othersite.com content except header and footer html.

How can I make my content on www.othersite.com available to search engines?

A: 

You can use meta tags and title tag to help search engines recognizing content of your page.

<meta name="description" content="Longer description of the content in the iframe">
<meta name="keywords" content="keyword1,keyword2,keyword3,foo,boo">
<title>Title of the page in the iframe</title>

There is also possibility to insert alternative content into iframe tag. This will be parsed by search engines and rendered only if iframes are disabled.

<iframe src="http://www.site1.com"&gt;Alternative content for SE and disabled iframes</iframe>

I think the best solution is to separete CSS of header,footer and content by encapsulating the parts with containers and selecting them only through container's id and then getting rid of iframes.

#header div.foo {/* some CSS here */}
#content div.boo {/* some CSS here */}
#footer div.moo {/* some CSS here */}
Petr Peller
-1 "insert content only for search engines (text hidden by CSS)" - this is bad practise IMO and pretty much the opinion ofmost SEO related articles I have read. Content should be created for the end user and NOT search engines.
Ahmad
@Ahmad I don't say it's good or the best practice. It's just one of possible solutions. (it will work)
Petr Peller
I think a better solution would be use the <noframes> tag to contain relevant information related to the iframe content. Not hidden in any way by CSS tricks. The question is access to the serving page..Does @Kamarey have access to put the content in.
Ahmad
@Petr Peller - the suggestion contradicts SEO guidelines and principles and falls into a grey area. It could be a solution, but I suggest against it.
Ahmad
@Ahmad You are true. The use of alternative content is much better solution than the with hidden text. I've edited the answer.
Petr Peller
@Ahmad: I have access to both: iframe content and iframe's owner. But can't change footer's and header's html, css, javascript. The idea with noframe tag is interesting, I will test it.@Petr Peller: I can't change the footer's and header's content. Didn't you mixed up the iframe with noframe in your edited answer?
Kamarey
@Kamarey `noframes` tag is usually used with regular frames (`frameset` tag). In case of iframes you should locate the content inside `iframe` pair tags. See example at http://www.w3schools.com/TAGS/tag_iframe.asp
Petr Peller
@Petr Peller: Why would I place content within an iframe if search engine will not parse it? Or they do? If so, why they don't parse the page pointed by iframe's src? What I missing?
Kamarey
@Kamarey The problem with iframes is the SE don't see it as part of the parent page but as absolutely separate page. It's HTML is in a separate file. While alternative content is present in the HTML code of the page so it is parsed as part of the page.
Petr Peller
+1  A: 

This is a pretty bad situation to be in.

If this is for any serious kind of project you need to unwravell this iframe issue and just get rid of them.

Its not that search engines can't use iframes, they can, but they index what is inside the iframe which in your case seems to be www.site1.com.

To get othersite in the search engines without removing the iframe might be possible but you will have to make a decision.

The idea

Put url rewriting on your iframe site (othersite.com) so that it will serve all the pages from site1.com. Use url rewriting not url redirects so that the page appears to be coming from the othersite.com.

Add a sitemap to othersite.com so that Google can find all these pages.

The decision

In order to avoid Google thinking othersite.com is just a clone of site1.com you are going to have to block site1.com from the search engines.

Block your site1.com from being indexed by using robots.txt

This will mean any google juice you have accrued such as page rank or ageing the domain etc will be lost. If this is a business that depends on the search engines for business you should think hard about this.

Conclusion

I have never tried this technique out its just an idea I have had to solve your problem.

Its not a pretty solution and not something you should go out of your way to do (if anyone else is reading this).

The best solution is for you to get rid of your iframes. If you have problems with not being able to control the html inside the header and footer frames then there are still better solutions than using an iframe.

For example, you could use HtmlAgilityPack to parse in the html that should be in these headers and spit it out into your template with altered ids so you can contain the css.

rtpHarry
Thank for the effort writing this answer. It will take time until I will be able to take care of this issue, so I can't tell is your answer worked or not. But definitely you have some good ideas. Thanks.
Kamarey