Search code examples
javascriptdynamicindexinggoogle-searchjsobject

Grabbing Data from a Single JS Object with multiple ID's be index'd by search engines


If i build a webpage that grabs data from a single JS object to fill out the page depending on what ID is sent in the URL, would this data be indexible by search engines? Basically i have a single page design with a header, description, and hero image. I don want to make this page 50 times so instead i have an object in JS that holds those 3 things for 50 IDs, each ID representing a grouping of content. Technically its one single page on my server but every time it loads to display information the URL will include the ID so the JS knows which content to display. Would browsers index each URL, or would it possibly read the JS object and index that way, or would none of this index at all?"


Solution

  • A few years ago, the answer would be: no, crawlers read the html page you return but don't execute any javascript on it to see how it looks after that.

    Nowadays, search engines may be able to do this. Here is a post explaining how google does it. TL;DR: If your javascript is not too complicated, it should work with google.

    Results might vary by search engine.

    If you want to be on the safe side, you could consider applying the described logic to server-side templating.