diff options
| author | Tom Christie | 2013-11-18 16:10:14 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-11-18 16:10:14 +0000 |
| commit | 20325cce1808cc3facd60acb15115d285ca10b0f (patch) | |
| tree | 784db6a931ceb5980386c0d47e425d45832bb06c /mkdocs.py | |
| parent | 4ddbeb1634481812cc12e0a839a2bd891d48b6a3 (diff) | |
| download | django-rest-framework-20325cce1808cc3facd60acb15115d285ca10b0f.tar.bz2 | |
Drop .html suffixes in docs
Diffstat (limited to 'mkdocs.py')
| -rwxr-xr-x | mkdocs.py | 9 |
1 files changed, 7 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,7 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir): else: main_title = 'Django REST framework - ' + main_title + 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 +156,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) |
