google app engine - How to add dynamic Facebook meta tags in GAE/GWT application -


i've seen techniques doing other platforms wonder if has clean way this.

my app has single host html file , uses standard mvp/places/activities parse hash fragment. displays variety of buttons different elements. fb (confirmed using lint tool) read static html of host page need manipulate before returned requester (there no point in messing around in gwt problem).

i use guice-y com.google.inject.servlet.servletmodule create like:

serve("/fb/*").with(metatagadder.class); 

and use /fb/* button urls. spew out html of hosting page (adding in dynamic meta tags needed). *.nocache.js files jump entrypoint.onmoduleload().

this seems sort of clunky. have more better idea?

so ended going way , works fine. create servlet dopost/doget methods write out host html , pass parameters it. url looks like:

http://example.com/fb/mypage.html?foo=baz#place:foo=baz 

then have parameters available create meta tags , forth:

// first chunk of static html resp.getwriter().println("<html><head><script type=\"text/javascript\" language=\"javascript\" src=\"/mymoodule/mymodule.nocache.js\"></script>");  // dynamic meta tags resp.getwriter().println("<meta property=\"og:title\" content=\"" + req.getparameter("foo") + "\" />");  // rest of static html resp.getwriter().println("</head><body></body></html>"); 

then when setting data-href attribute on fb-like div, use url above. works seo. considerations production systems:

  • navigation elements in site should drive user straight hosted version. can tricky. understand have query strings in http request remaining static while hash fragment evolves react user.
  • if have limited range of parameters , processing on parameters, use memcache in httpservlet cache semi-static copies of html returned clients.
  • don't putting stuff in body trying jazzy seo. heartache lies in direction.

i'm still fooling around tuning don't see drop dead show stoppers @ point.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -