diff options
| author | Tom Christie | 2013-12-13 16:32:34 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-12-13 16:32:34 +0000 |
| commit | 9c41c007afc71c899306bcb02e40bdfc36b09146 (patch) | |
| tree | ca0da04aed0c1b96ddf14a801dc54b5a72a72461 /mkdocs.py | |
| parent | ed931b90ae9e72f963673e6e188b1802a5a65360 (diff) | |
| parent | ca244ad614e2f6fb4fef1dc9987be996d2624303 (diff) | |
| download | django-rest-framework-9c41c007afc71c899306bcb02e40bdfc36b09146.tar.bz2 | |
Merge branch 'master' into 2.4.0
Conflicts:
.travis.yml
docs/api-guide/routers.md
docs/topics/release-notes.md
rest_framework/compat.py
Diffstat (limited to 'mkdocs.py')
| -rwxr-xr-x | mkdocs.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -19,7 +19,7 @@ if local: index = 'index.html' else: base_url = 'http://django-rest-framework.org' - suffix = '.html' + suffix = '' index = '' @@ -90,7 +90,10 @@ for idx in range(len(path_list)): path = path_list[idx] rel = '../' * path.count('/') - if idx > 0: + if idx == 1 and not local: + # Link back to '/', not '/index' + prev_url_map[path] = '/' + elif idx > 0: prev_url_map[path] = rel + path_list[idx - 1][:-3] + suffix if idx < len(path_list) - 1: @@ -143,6 +146,10 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir): else: main_title = 'Django REST framework - ' + main_title + if relative_path == 'index.md': + canonical_url = base_url + else: + canonical_url = base_url + '/' + relative_path[:-3] + suffix prev_url = prev_url_map.get(relative_path) next_url = next_url_map.get(relative_path) @@ -152,6 +159,7 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir): output = output.replace('{{ title }}', main_title) output = output.replace('{{ description }}', description) output = output.replace('{{ page_id }}', filename[:-3]) + output = output.replace('{{ canonical_url }}', canonical_url) if prev_url: output = output.replace('{{ prev_url }}', prev_url) |
