Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit f7ac8ef

Browse files
committed
chore(docs): support _escaped_fragment_ hack for crawler
1 parent 4a4b28d commit f7ac8ef

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

docs/src/gen-docs.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function writeTheRest(writesFuture) {
5454

5555

5656
writesFuture.push(writer.copy('docs/src/templates/index.html', 'index-jq.html',
57-
writer.replace, {'doc:manifest': manifest}));
57+
writer.replace, {'doc:manifest': ''}));
5858

5959
writesFuture.push(writer.copy('docs/src/templates/index.html', 'index-jq-nocache.html',
6060
writer.replace, {'doc:manifest': ''}));
@@ -94,6 +94,7 @@ function writeTheRest(writesFuture) {
9494
writesFuture.push(writer.copyTpl('app.yaml'));
9595
writesFuture.push(writer.copyTpl('index.yaml'));
9696
writesFuture.push(writer.copyTpl('favicon.ico'));
97+
writesFuture.push(writer.copyTpl('main.py'));
9798
}
9899

99100

docs/src/templates/app.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ default_expiration: "2h"
77

88
handlers:
99
- url: /
10-
static_files: index.html
11-
upload: index.html
10+
script: main.app
1211

1312
- url: /appcache.manifest
1413
static_files: appcache.manifest

docs/src/templates/main.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import webapp2
2+
from google.appengine.ext.webapp import template
3+
4+
5+
class IndexHandler(webapp2.RequestHandler):
6+
def get(self):
7+
fragment = self.request.get('_escaped_fragment_')
8+
9+
if fragment:
10+
fragment = '/partials' + fragment + '.html'
11+
self.redirect(fragment, permanent=True)
12+
else:
13+
self.response.headers['Content-Type'] = 'text/html'
14+
self.response.out.write(template.render('index-nocache.html', None))
15+
16+
17+
app = webapp2.WSGIApplication([('/', IndexHandler)])
18+

0 commit comments

Comments
 (0)