/webmasters/community?hl=en
/webmasters/community?hl=en
6/20/10
Original Poster
loupiote

best way to include static content in dynamic pages?

i have pages that contain some dynamic content.

i am able to generate a "static" version of this dynamic content and include it in my html pages so that this content gets indexed by the search engines. this "static" content is invisible from the normal user, and replaced by an identical "dynamic" content - unless the user turns off javascript in their browser, of course.

but what is the best way to include this "static" content?


2010-06-20
solution 1)
<noscript>
... static content ...
</noscript>

solution 2)
<div class="invisible">
... static content ...
</div>

and define the CSS for class="invisible" with "display:none"

which of those will work better?
will anything inside a  
<noscript>...</noscript> be treated with less weight than normal content?

2010-06-20
solution 3) [probably the best]

include the static comment in a block that will be swapped by the dynamic version.
Community content may not be verified or up-to-date. Learn more.
All Replies (39)
RainboRick
6/20/10
RainboRick
Generally speaking, it is a violation of the guidelines of all of the major search engines to include content in your pages that is only visible to the search engines.  Using <noscript> would mitigate that issue, but I wouldn't count on the search engines paying very much attention to that content.  You definitely do not want to use CSS to make content invisible, unless you provide a clear mechanism for the user to make it visible.  Overall, this sort of thing falls into the category of "not worth the effort".  If you want a page to perform well for particular search terms, use those terms in prominent locations on that page.  Any other approach is almost sure to be a waste of time.  Good luck!

webado
6/20/10
webado
What do you mean by  identical "dynamic" content  ?
6/20/10
Original Poster
loupiote
Generally speaking, it is a violation of the guidelines of all of the major search engines to include content in your pages that is only visible to the search engines.

i know, of course, this would be "cloaking". but this is not the case here. the contents visible to the viewer contains the same text, but the text in question is in DOM elements that are normally dynamically generated.

there is an example on this page:

look for the text "An amzing photo. Deserves to become one of the iconic images of the early 21st century. (Yes, it's that good.)" toward the bottom of the page.

the (moderated) comment made by a user is in a dynamic DOM element generated by js-kit. but i want those to be seen in the static version of the page (not just search engine, but any browser with no javascript, too - i.e. it's not cloaking based on user-agent)..

so if you look at this page with no javascript, or if you look at the source, you will still see this text which is normally in a dynamic elemeny if you have javascript.


6/20/10
Original Poster
loupiote
but I wouldn't count on the search engines paying very much attention to that content.

so any content that is in a <noscript> section is virtually ignored by search engines?

so when you have ajax-based sites with lots of dynamic content (for which you can provide the same content in static form, like here), what is the preferred / recommended way to present it so that it gets indexed?
webado
6/20/10
webado
>>so any content that is in a <noscript> section is virtually ignored by search engines
 
Not at all. On the contrary. But its justification has to be that it is equivalent to whatever is otherwise visible in javascript.
 
So in case you serve something drastically different in noscript than what yo have in a script, it's possible either robots will discover it, or competitors who are only looking for an opportunity to sink your site might.
 
 
I didn't see whatever your page was supposed to have with or without javascript. It looks like the stylesheet is shot or something. Maybe because you have content at the top before the doctype.
 
6/20/10
Original Poster
loupiote
ouch - thanks for the heads-up... yes, there is a comment before the doc-type.... i didn't realize html comments were not allowed before the doc-type, i'll have to fix that :(

>>so any content that is in a <noscript> section is virtually ignored by search engines
 
Not at all. On the contrary. But its justification has to be that it is equivalent to whatever is otherwise visible in javascript.

good

So in case you serve something drastically different in noscript than what yo have in a script, it's possible either robots will discover it, or competitors who are only looking for an opportunity to sink your site might.

so since i serve the exact same content, there should be no problem there. thanks!

i'll fix that page so that you can see it...

no problem seeing it with chrome - what browser are you using that trips on this spurious comment line at the top of the file?

webado
6/20/10
webado
>. didn't realize html comments were not allowed before the doc-type,
 
It's not that they are not allowed, but anything before the doctype makes the browser render the page in quirks mode, and then parts of the stylesheet largely no longer work. 
 
 
 
webado
6/20/10
webado
IE7.
 
Quirks mode is different for every browser.
 
I see what you wanted to have in Chrome. One heck of a busy page.
 
Well fix your markup and your css (http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http%3A%2F%2Fwww.loupiote.com%2Fphotos%2F3004192959.shtml ) so it's all valid and then it will work in all browsers more or less the same way.
6/20/10
Original Poster
loupiote
ewww, yes, this is fixed now on this page. it was a recent change and i forgot to pass that in the checker.

doc-type is duplicated - shouldn't be a problem, and it will be fixed once many pages have been regenerated, in a little while.
webado
6/20/10
webado
You also have a javascript error reproted as being line 890 - object expected. I've not figured out just what it is.
 
 
28 MORE
6/26/10
Original Poster
loupiote
by the way, i am now doing what JohnMu suggested, i.e. i include the static content in a block that will be swapped by the dynamic version (that has essentially the same content). i think it's a good solution.

Were these replies helpful?
How can we improve them?
 
This question is locked and replying has been disabled. Still have questions? Ask the Help Community.

Badges

Some community members might have badges that indicate their identity or level of participation in a community.

 
Google Employee — Google product team members and community managers
 
Community Specialist — Google partners who help ensure the quality of community content
 
Platinum Product Expert — Community members with advanced product knowledge who help other Google users and Product Experts
 
Gold Product Expert — Community members with in-depth product knowledge who help other Google users by answering questions
 
Silver Product Expert — Community members with intermediate product knowledge who help other Google users by answering questions
 
Product Expert Alumni — Former Product Experts who are no longer members of the program
Community content may not be verified or up-to-date. Learn more.

Levels

Member levels indicate a user's level of participation in a forum. The greater the participation, the higher the level. Everyone starts at level 1 and can rise to level 10. These activities can increase your level in a forum:

  • Post an answer.
  • Having your answer selected as the best answer.
  • Having your post rated as helpful.
  • Vote up a post.
  • Correctly mark a topic or post as abuse.

Having a post marked and removed as abuse will slow a user's advance in levels.

View profile in forum?

To view this member's profile, you need to leave the current Help page.

Report abuse in forum?

This comment originated in the Google Product Forum. To report abuse, you need to leave the current Help page.

Reply in forum?

This comment originated in the Google Product Forum. To reply, you need to leave the current Help page.