Skip to content

Commit 92a4a5d

Browse files
authored
Fix docs 404 (#7197)
* Use 'site_url' instead of hardcoding DRF homepage * Use 'url' template filter instead of 'base_url' This fixes static file loading for the 404 page. * Only insert funding <hr> if toc is present * Link quickstart to valid API guide page * Fix 404 search modal link * Use 'base_url' instead of 'site_url' on 404 page
1 parent 4faa674 commit 92a4a5d

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

docs/tutorial/quickstart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ Finally, we're including default login and logout views for use with the browsab
137137

138138
## Pagination
139139
Pagination allows you to control how many objects per page are returned. To enable it add the following lines to `tutorial/settings.py`
140-
140+
141141
REST_FRAMEWORK = {
142142
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
143143
'PAGE_SIZE': 10
144144
}
145-
145+
146146
## Settings
147147

148148
Add `'rest_framework'` to `INSTALLED_APPS`. The settings module will be in `tutorial/settings.py`
@@ -224,5 +224,5 @@ If you want to get a more in depth understanding of how REST framework fits toge
224224

225225
[image]: ../img/quickstart.png
226226
[tutorial]: 1-serialization.md
227-
[guide]: ../#api-guide
227+
[guide]: ../api-guide/requests.md
228228
[httpie]: https://github.com/jakubroztocil/httpie#installation

docs_theme/404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
<h1 id="404-page-not-found" style="text-align: center">404</h1>
66
<p style="text-align: center"><strong>Page not found</strong></p>
7-
<p style="text-align: center">Try the <a href="https://www.django-rest-framework.org/">homepage</a>, or <a href="#searchModal" data-toggle="modal">search the documentation</a>.</p>
7+
<p style="text-align: center">Try the <a href="{{ base_url }}">homepage</a>, or <a href="#mkdocs_search_modal" data-toggle="modal">search the documentation</a>.</p>
88

99
{% endblock %}

docs_theme/main.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
66
<meta charset="utf-8">
77
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
8-
<link href="{{ base_url }}/img/favicon.ico" rel="icon" type="image/x-icon">
8+
<link href="{{ 'img/favicon.ico'|url }}" rel="icon" type="image/x-icon">
99
<link rel="canonical" href="{{ page.canonical_url|url }}" />
1010
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1111
<meta name="description" content="Django, API, REST{% if page %}, {{ page.title }}{% endif %}">
1212
<meta name="author" content="Tom Christie">
1313

1414
<!-- Le styles -->
15-
<link href="{{ base_url }}/css/prettify.css" rel="stylesheet">
16-
<link href="{{ base_url }}/css/bootstrap.css" rel="stylesheet">
17-
<link href="{{ base_url }}/css/bootstrap-responsive.css" rel="stylesheet">
18-
<link href="{{ base_url }}/css/default.css" rel="stylesheet">
15+
<link href="{{ 'css/prettify.css'|url }}" rel="stylesheet">
16+
<link href="{{ 'css/bootstrap.css'|url }}" rel="stylesheet">
17+
<link href="{{ 'css/bootstrap-responsive.css'|url }}" rel="stylesheet">
18+
<link href="{{ 'css/default.css'|url }}" rel="stylesheet">
1919

2020
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
2121
<!--[if lt IE 9]>
@@ -102,7 +102,7 @@ <h3 id="myModalLabel">Documentation search</h3>
102102
{% endfor %}
103103

104104
<div class="promo">
105-
<hr/>
105+
{% if page.toc %}<hr/>{% endif %}
106106
<div id="sidebarInclude">
107107
</div>
108108
</ul>
@@ -139,10 +139,10 @@ <h3 id="myModalLabel">Documentation search</h3>
139139
================================================== -->
140140
<!-- Placed at the end of the document so the pages load faster -->
141141
<script async src="https://fund.django-rest-framework.org/sidebar_include.js"></script>
142-
<script src="{{ base_url }}/js/jquery-1.8.1-min.js"></script>
143-
<script src="{{ base_url }}/js/prettify-1.0.js"></script>
144-
<script src="{{ base_url }}/js/bootstrap-2.1.1-min.js"></script>
145-
<script src="{{ base_url }}/js/theme.js"></script>
142+
<script src="{{ 'js/jquery-1.8.1-min.js'|url }}"></script>
143+
<script src="{{ 'js/prettify-1.0.js'|url }}"></script>
144+
<script src="{{ 'js/bootstrap-2.1.1-min.js'|url }}"></script>
145+
<script src="{{ 'js/theme.js'|url }}"></script>
146146

147147
<script>var base_url = '{{ base_url }}';</script>
148148
{% for path in config.extra_javascript %}

0 commit comments

Comments
 (0)