Sunday, November 15, 2015

Re: SEO Google Crawlable experience ?

BTW, for those using Places, here's an Html5Historian "template": https://gist.github.com/tbroyer/1883821
We use it in prod for more than 2 years (IIRC), in an intranet app designed for Firefox alone (few users, helped cut the dev costs); also tested in Chrome, but not in any version of IE (no fallback to either localhost.hash or location.assign).
To avoid this situation with relative URLs, we're just and only using the query-string; trading the "#" for "?p=".
The goal was to eventually add optimizations such as preloading data into the page depending on the query-string, but we never actually did anything so still just using this as the exact equivalent of the "standard history handling" in GWT.

On Monday, November 16, 2015 at 12:11:29 AM UTC+1, Ed wrote:
Oeps, I wasn't finished yet, and pressed send. Let's continue were I left off:
BTW: the above rewrite rule with resource in it, can be removed if you don't have that path. Ensure to put the above in the <Directory> tag, else the REQUEST_FILENAME will not be filled yet and will contain the URI, and that's not what you want, such that it doesn't work... (took me some time to figger that out ;)

Then in the front-end, do what ever you want with the url it's start with, show the context what you want.

Then the pushState thing. I started with the gwt-pushstate project on github, but it doesn't work with gwt 2.7 due to changes in the gwt History class.
As such, I replaced the History class with my own version that I use. It can use the old url fragment style or the push state if supported (not tested all well I have to admit).
Have a look at the code attached, start with the BrowserHistory class, that is the replacement class of the gwt History class, and also contains a lot of code of that class. It will talk to a SimpleBrowserHistory class that is created through deferred binding and will use the pushState subclass if pushState is supported. The support is detected though the attached gwt file (thanks to code from gwt-pushstate on github).
I might change some thinks in the future if I have a moment and optimize thinks, but for now it works well.
Just look around in the code, and if you have any questions, just shoot.





--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment