@@ -114,6 +114,70 @@ http://{{ caddy.addresses.main }}, http://{{ ansible_fqdn }} {
114114 rewrite / /mpl-brochure-site/index.html
115115 rewrite @brochure /mpl-brochure-site{http.matchers.file.relative}
116116
117+ # Redirect any of the old top-level files to the versioned docs.
118+ redir /citing.html /stable/project/citing.html permanent
119+ redir /contents.html /stable/users/ permanent
120+ redir /downloads.html /stable/users/installing/ permanent
121+ redir /gallery.html /stable/gallery/ permanent
122+ redir /py-modindex.html /stable/py-modindex.html permanent
123+ {# 3.5.0 was the last version to be synced to the top-level directory.
124+ We also try for stable, just to go to the best version possible. #}
125+ {% - with old_versions = [
126+ "stable" ,
127+ "3.5.0" ,
128+ "3.4.3" , "3.4.2" , "3.4.1" , "3.4.0" ,
129+ "3.3.4" , "3.3.3" , "3.3.2" , "3.3.1" , "3.3.0" ,
130+ "3.2.2" , "3.2.1" , "3.2.0" ,
131+ "3.1.3" , "3.1.1" , "3.1.0" ,
132+ "3.0.3" , "3.0.2" , "3.0.0" ,
133+ "2.2.5" , "2.2.4" , "2.2.3" , "2.2.2" , "2.2.0" ,
134+ "2.1.2" , "2.1.1" , "2.1.0" ,
135+ "2.0.2" , "2.0.1" , "2.0.0" ,
136+ "1.5.3" , "1.5.1" , "1.5.0" ,
137+ "1.4.3" , "1.4.2" , "1.4.1" , "1.4.0" ,
138+ "1.3.1" , "1.3.0" , "1.2.1" ,
139+ ] %}
140+ {% - with old_toplevel_dirs = [
141+ "_downloads" ,
142+ "_images" ,
143+ "_modules" ,
144+ "_panels_static" ,
145+ "_sources" ,
146+ "_static" ,
147+ "api" ,
148+ "devel" ,
149+ "examples" ,
150+ "faq" ,
151+ "gallery" ,
152+ "glossary" ,
153+ "mpl_examples" ,
154+ "mpl_toolkits" ,
155+ "plot_directive" ,
156+ "plot_types" ,
157+ "pyplots" ,
158+ "resources" ,
159+ "tutorials" ,
160+ "users" ,
161+ ] %}
162+ @old-toplevel-dirs {
163+ path{% for dir in old_toplevel_dirs %} /{{dir}} /{{dir}}/{% endfor +%}
164+ file {
165+ root {{ caddy.site_dir }}/matplotlib.github.com
166+ try_files{% for version in old_versions %} /{{version}}/{path}/index.html{% endfor +%}
167+ }
168+ }
169+ redir @old-toplevel-dirs {http.matchers.file.relative} permanent
170+ @old-toplevel-dir-contents {
171+ path{% for dir in old_toplevel_dirs %} /{{dir}}/*{% endfor +%}
172+ file {
173+ root {{ caddy.site_dir }}/matplotlib.github.com
174+ try_files{% for version in old_versions %} /{{version}}/{path}.html /{{version}}/{path}{% endfor +%}
175+ }
176+ }
177+ redir @old-toplevel-dir-contents {http.matchers.file.relative} permanent
178+ {% - endwith -%}
179+ {% - endwith +%}
180+
117181 # Finally try any of the versioned docs.
118182 handle {
119183 root * {{ caddy.site_dir }}/matplotlib.github.com
0 commit comments