diff options
Diffstat (limited to 'mkdocs.py')
| -rwxr-xr-x | mkdocs.py | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -18,8 +18,8 @@ if local: suffix = '.html' index = 'index.html' else: - base_url = 'http://django-rest-framework.org' - suffix = '.html' + base_url = 'http://www.django-rest-framework.org' + 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: @@ -141,8 +144,12 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir): if filename == 'index.md': main_title = 'Django REST framework - APIs made easy' else: - main_title = 'Django REST framework - ' + main_title + main_title = main_title + ' - Django REST framework' + 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,13 @@ 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 filename =='index.md': + output = output.replace('{{ ad_block }}', """<hr><p><strong>The team behind REST framework is launching a new API service.</strong></p> +<p>If you want to be first in line when we start issuing invitations, please <a href="http://brightapi.com">sign up here</a>.</p>""") + else: + output = output.replace('{{ ad_block }}', '') if prev_url: output = output.replace('{{ prev_url }}', prev_url) |
