Elm SPA caused all our pages to be removed from Google Search

Thanks @jmpavlick. We had already done these things upfront. Despite all that, it didn’t appear to help.

We have lots of fresh content crawled, but simply JavaScript is not being run.

1 Like

@berend ah that’s frustrating!

Just a shot in the dark, do you have anything wild going on during site initialization? Any wild structures coming in to flags, anything like that? How is your call to the Elm application referenced from your index.html page?

If I suspected that my JS wasn’t being run, I would set up an API endpoint that I could call with the browser’s user agent and the “source” as a query parameter. Call it once directly from the script section that should be loading your Elm app with a “source” of "fromScript", and pass it in as a flag value and call it from init with a “source” of "fromElm". Log datestamps, the user agent, and the “source” on the other end of your API endpoint, and you’ll be able to see if Googlebot is:

  • not running JS at all, anywhere, ever
  • only running JS directly from the script tag and not loading the Elm executable
  • doing both but somehow still not indexing anything

Again, just a shot in the dark; but might be worth it as a last-ditch effort.

1 Like

One potential issue I noticed is the HTML tag:

<html lang="en">

It might be possible to update this value in Elm (using ports), but I suspect removing it is your best bet. (package.elm-lang.org does not set a lang).

Google seems to believe the attribute too, even when the content isn’t English:

4 Likes

This thread is gold dust, love it!

2 Likes

We have now put the site behind prerender.io. I’ll report back what that did to the indexing.

1 Like

It seems that the site is indexed now. Already the effect of prerender.io?

Nah, these are just remainders of the site that was replaced.

1 Like

And an update: Google likes us again. We’re back in the index, hits are up to almost pre-change levels.

16 Likes

Do you have any ideas about the root-cause?

Google didn’t fire up the browser for us, that’s what it seemed to have been, but the root cause? We must have done something wrong, but it was a really simple index.html. No idea yet.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.