Skip to content

Commit 86cd696

Browse files
committed
Move third-party packages to /thirdpartypackages
Also, add an alias of `/3pp` and redirect the `/mpl-third-party` path to the new path.
1 parent 8193fae commit 86cd696

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

matplotlib.org.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
site_dir: "/usr/share/caddy"
99
tls_config: "tls /etc/caddy/tls/cert.pem /etc/caddy/tls/privkey.pem"
1010
repos:
11-
- mpl-brochure-site
12-
- matplotlib.github.com
13-
- basemap
14-
- cheatsheets
15-
- cycler
16-
- devdocs
17-
- governance
18-
- ipympl
19-
- matplotblog
20-
- mpl-bench
21-
- mpl-gui
22-
- mpl-sphinx-theme
23-
- mpl-third-party
24-
- pytest-mpl
25-
- data-prototype
11+
mpl-brochure-site:
12+
matplotlib.github.com:
13+
basemap:
14+
cheatsheets:
15+
cycler:
16+
devdocs:
17+
governance:
18+
ipympl:
19+
matplotblog:
20+
mpl-bench:
21+
mpl-gui:
22+
mpl-sphinx-theme:
23+
mpl-third-party: thirdpartypackages
24+
pytest-mpl:
25+
data-prototype:
2626
vars_files:
2727
- files/webhook_vars.yml
2828
tasks:
@@ -162,7 +162,7 @@
162162
mode: 0755
163163
owner: caddy
164164
group: caddy
165-
loop: "{{ repos }}"
165+
loop: "{{ repos.keys() }}"
166166

167167
- name: Clone Git repositories
168168
become: true
@@ -174,7 +174,7 @@
174174
{{
175175
(item == 'matplotlib.github.com') | ternary('main', 'gh-pages')
176176
}}
177-
loop: "{{ repos }}"
177+
loop: "{{ repos.keys() }}"
178178

179179
# Caddy server setup
180180
# ##################

templates/Caddyfile.j2

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
(subproject) {
44
# Caddy doesn't know this is a directory, so redirect to trailing / as
55
# would usually happen for them.
6-
redir /{args[0]} /{args[0]}/ permanent
6+
redir /{args[1]} /{args[1]}/ permanent
77

8-
handle_path /{args[0]}/* {
8+
handle_path /{args[1]}/* {
99
root * {{ caddy.site_dir }}/{args[0]}
1010
try_files {path}.html {path}
1111
file_server {
@@ -70,8 +70,8 @@ http://{{ caddy.addresses.main }}, http://{{ ansible_fqdn }} {
7070

7171
root * {{ caddy.site_dir }}
7272

73-
{% for site in repos %}
74-
import subproject {{ site }}
73+
{% for site, path in repos.items() %}
74+
import subproject {{ site }} {{ path | default(site, true) }}
7575
{% endfor %}
7676

7777
# Hide mpl-altair until the site is fixed.
@@ -96,6 +96,16 @@ http://{{ caddy.addresses.main }}, http://{{ ansible_fqdn }} {
9696
}
9797
}
9898

99+
# Redirect the repo-named third-party packages path to the more-generic path.
100+
redir /3pp /thirdpartypackages/ # And also add a shortcut.
101+
@mpl-third-party path /mpl-third-party /mpl-third-party/*
102+
handle @mpl-third-party {
103+
route {
104+
uri strip_prefix /mpl-third-party
105+
redir * /thirdpartypackages{uri}
106+
}
107+
}
108+
99109
# Place the brochure site at the top level.
100110
@brochure file {
101111
root {{ caddy.site_dir }}/mpl-brochure-site

0 commit comments

Comments
 (0)