1

I'm having a webpage (a stem URL) with several iframes inside it with slightly differing src. It's like a @book has_many :pages and each page is an iframe with serially increasing page_no.

How should I ensure that the content inside iframes are properly indexed and the STEM URL becomes the parent to all the src urls of pages underneath?

Oh yes, I'm happy to have all search engines look at the content do it properly.

2

As far as I know, there is no way to have your HTML frame site get indexed the way you want. Google always indexes content at the URL of the child frame, not at the URL of the parent frame.

Lack of search engine support is one of the reasons that frames are so rarely used on the web. It is far more common to rely on server side technology to build a full page rather than to send it to users in parts.


Rather than rely on search engines to index different pages, you can use JavaScript to enforce your FrameSet. If you have navigation that is in a frame on the side, I have sometimes seen JavaScript used to add it back in. Let's say that a visitor lands on page3.html, it might have some JavaScript like this:

if (window.top == window.self) {
    window.location = "http://example.com/frame.html#page3.html";
}

Then frame.html might have JavaScript to set the correct page based on the fragment identifier:

if(/^page[0-9]+\.html$/.test(window.location.hash)) {
    document.getElementById('frame-for-the-pages').src = window.location.hash;
}

Where frame-for-the-pages is the id assigned to that part of your frameset:

<frame id="frame-for-the-pages" src="page1.html">

There are also some newer tools from Google that you could try. It's been so long since everybody gave up on frames that I'm not sure that anybody has tried:

Rel canonical

Use rel canonical meta tags in each of the child frames to point back to the parent frame. These tags can cause Google to index content as if it were at a different URL. I would only do for cases in which the parent frame shows the child frame immediately (without the user having to click around to it.) Otherwise you run the risk of "cloaking": Having Google index content that isn't available to users easily which can draw a penalty from Google.

Crawlable AJAX

Frames are not much different than AJAX in so far as the content in the frame is dynamically fetched client side. It might be possible to apply the same crawlable AJAX techniques to frames: Create HTML snapshots of all your pages and serve them at _escaped_fragment URLs while having Google send visitors to the frame URL.

|improve this answer|||||
  • Okay. So the thing is that the STEM url has almost zero content. It's all behind iframes for each page of the book. Like this: bubbl.in/book/the-solar-system-by-marvin-danig Crawlable AJAX sounds like an interesting approach. Thanks for the tips! – marvindanig Mar 11 '15 at 17:08
  • I've added a JavaScript solution to my answer that you might find useful. – Stephen Ostermiller Mar 11 '15 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.