0

Having tested a simple (hello world) app in ember a few months ago, I was really excited because I knew that Google was able to fetch and therefore index it. Another app I built in Angular a few years was also being indexed! So I pressed on with my ember development and now have an application ready to deploy. This uses a PHP/MySQL backend api.

Today, I uploaded the production build to a server and then checked things in webmaster tools using the fetch and render tool. This time, nothing is being rendered !!!! I have double checked and uploaded the hello world app to the same server, which was fetched and rendered without any problem. I have absolutely no idea why this is happening!

I then looked at ember-cli-fastboot (having not really worried about it before because I thought that Google could index single page apps) and when I run

ember fastboot --serve-assets

I get

jQuery is not defined
ReferenceError: jQuery is not defined

So I'm now at a complete standstill after a lot of work!

Any help in resolving this would be much appreciated! Ideally I don't want to have to use fastboot, but if I have to, I'm not sure how to resolve the above issue.

Newfoundland
  • 497
  • 6
  • 17

1 Answers1

0

unfortunately, ember-fastboot has some limitations and jQuery is one of them. You could use Phantom-based prerender instead.

G07cha
  • 4,009
  • 2
  • 22
  • 39
  • Many thanks for getting back and confirming. I'll look into prerender but I was really hoping to understand why a simple app gets fetched by Google but not the one I've developed :-( Is there any more information I can provide here to help? – Newfoundland Jun 16 '16 at 16:23
  • You probably should read more about Single Page Applications, they have a lot of upsides and downsides, one of the downsides is that almost all frontend will be generated on client-side, Google bot doesn't wait for render(or not using JavaScript) and as a result, receive a blank page. So you should either run prerender on server-side and serve prerendered content for bots or switch to server-side rendering for everyone. – G07cha Jun 16 '16 at 16:28
  • Hi, thanks for getting back. I was of the understanding that Google can now render single page apps. The app I wrote in Angular (version 1) a couple of years ago is fully indexed by Google! – Newfoundland Jun 17 '16 at 06:32
  • I don't know a lot about AngularJS but recently I had the same problem with EmberJS which was solved by using prerender. – G07cha Jun 17 '16 at 07:38
  • Very frustrating - been doing some tests with a simple app making requests to the api - was fetching ok and now it's stopped !!!!! Re prerender, do you have to use hash bangs #! and if so, how do you specify this in ember? – Newfoundland Jun 17 '16 at 09:53
  • Nope, I'm using [ember-prerender](https://github.com/zipfworks/ember-prerender) it's very flexible. You said you have problems with accessing to API? – G07cha Jun 17 '16 at 09:55
  • Hi - will take a look at this version asap! No, not having any issues with the API. Will you know how I get on with ember-prerender – Newfoundland Jun 17 '16 at 11:29
  • Hi, sorry for delay - I did try ember-prerender but had problems with the install both on Windows 10 and Linux. Had to give up on that as a result - do you have any tips on that? Have been trying prerender.io but also not getting much luck! – Newfoundland Jun 21 '16 at 08:00
  • Hi, both ember-prerender and prerender.io based on PhantomJS so you also could try to build you own little prerender using PhantomJS [like this](http://stackoverflow.com/questions/16856036/save-html-output-of-page-after-execution-of-the-pages-javascript). And serve rendered pages for bots. – G07cha Jun 21 '16 at 13:08
  • 1
    Hi, as I thought - Google can index my single page app. The reason it wasn't doing so before was that there was an error with the javascript which wasn't immediately obvious. Now that's been solved, the fetch and render tool is working perfectly, even for the index page which takes a while to load as I am prefetching quite a bit of data! So no need for the prerender service, at least as far as Google is concerned! – Newfoundland Jun 22 '16 at 13:03
  • Hi, I'm happy that your problem solved, sorry for misdirection. – G07cha Jun 22 '16 at 13:08
  • No problem at all - none taken! I'm not sure about the other search engines, and the best way to handle 404's etc but it is good news nonetheless! Many thanks for your time/ – Newfoundland Jun 22 '16 at 13:33