Domanda

I have some text actually 20+ pieces of large text and i add it into an array

var translation = new Array();
translation [0] = "<p>English</p> Lorem ipsum dolor sit amet, consectetur adipisicing elit"
translation [1] = "<p>French</p> Lorem ipsum dolor sit amet, consectetur adipisicing elit"
translation [2] = "<p>German</p> Lorem ipsum dolor sit amet, consectetur adipisicing elit"
translation [3] = "<p>Italian</p> Lorem ipsum dolor sit amet, consectetur adipisicing elit"

and then i want to call them like that -

$('<div/>', {
class: "trpanel",
html: translation[0],
 })
.appendTo('body');

it will be a bit more complicated than that because you will be able to see each text according to what you have seen before. But that doesn't matter at this stage. What i am interested in is if in the future this text will be searchable by google. I am a rookie obviously but i could add all these as hidden html elements change class and show them instead when needed. What is the best solution for being indexed by google? I very much prefer to have them in my .js file whithout the need to search each time for each one.

È stato utile?

Soluzione

It will not be indexed.

To help SEO in dynamic text, you might use a different approach.

Instead of an array of strings in javascript code, create all the text in the html page, using html elements; and dynamically set its visibility.

For example, see this fiddle http://jsfiddle.net/zVTKq/2/

it shows how to select from a set of divs placed insiden an invisible div container, and selectively displays the appropiate text

$('#translated').html($("#translation-en").html());
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top