Permalink
Browse files

/page/ URL redirects to page in default version

As I suggested in #282, this adds a URL pattern that can redirect to a specific
page under the default version. Using "/page/..." either on readthedocs.org or
a subdomain redirects.

Note that the redirect goes to "/docs/<project_slug>/..." even on subdomains.
This could be fixed by using a different URL pattern name for the subdomain
URLs and specifically requesting that in the call to `reverse()`.
  • Loading branch information...
1 parent 908486f commit f78ab59864c5960b366f8b80161d4e4fa1eeb86f @sampsyo sampsyo committed Oct 21, 2012
Showing with 13 additions and 1 deletion.
  1. +6 −0 readthedocs/core/subdomain_urls.py
  2. +7 −1 readthedocs/urls.py
View
6 readthedocs/core/subdomain_urls.py
@@ -15,6 +15,12 @@
'core.views.serve_docs',
name='docs_detail'
),
+ url(r'^page/(?P<filename>.*)$',
+ 'core.views.serve_docs',
+ {'version_slug': None,
+ 'lang_slug': None},
+ name='docs_detail'
+ ),
url(r'^(?P<lang_slug>\w{2})/(?P<version_slug>.*)/$',
'core.views.serve_docs',
{'filename': 'index.html'},
View
8 readthedocs/urls.py
@@ -34,14 +34,20 @@
name='docs_detail'
),
- #This is for redirecting /docs/pip/ -> /docs/pip/en/latest/
+ # Redirect to default version.
url(r'^docs/(?P<project_slug>[-\w]+)/$',
'core.views.serve_docs',
{'version_slug': None,
'lang_slug': None,
'filename': ''},
name='docs_detail'
),
+ url(r'^docs/(?P<project_slug>[-\w]+)/page/(?P<filename>.*)$',
+ 'core.views.serve_docs',
+ {'version_slug': None,
+ 'lang_slug': None},
+ name='docs_detail'
+ ),
#WTF are these both here?
#url(r'^docs/', include('projects.urls.public')),

0 comments on commit f78ab59

Please sign in to comment.