From f7ac8ef97a12282e66eb540a542c09b9d14b2874 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sat, 25 Aug 2012 02:30:55 -0700 Subject: chore(docs): support _escaped_fragment_ hack for crawler --- docs/src/templates/app.yaml | 3 +-- docs/src/templates/main.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 docs/src/templates/main.py (limited to 'docs/src/templates') diff --git a/docs/src/templates/app.yaml b/docs/src/templates/app.yaml index c204b150..3ab26d55 100644 --- a/docs/src/templates/app.yaml +++ b/docs/src/templates/app.yaml @@ -7,8 +7,7 @@ default_expiration: "2h" handlers: - url: / - static_files: index.html - upload: index.html + script: main.app - url: /appcache.manifest static_files: appcache.manifest diff --git a/docs/src/templates/main.py b/docs/src/templates/main.py new file mode 100644 index 00000000..e31697d2 --- /dev/null +++ b/docs/src/templates/main.py @@ -0,0 +1,18 @@ +import webapp2 +from google.appengine.ext.webapp import template + + +class IndexHandler(webapp2.RequestHandler): + def get(self): + fragment = self.request.get('_escaped_fragment_') + + if fragment: + fragment = '/partials' + fragment + '.html' + self.redirect(fragment, permanent=True) + else: + self.response.headers['Content-Type'] = 'text/html' + self.response.out.write(template.render('index-nocache.html', None)) + + +app = webapp2.WSGIApplication([('/', IndexHandler)]) + -- cgit v1.2.3