From 8193faece17e935f228dc40f6b3e6dfcf22d82fc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 8 Oct 2024 21:13:45 -0400 Subject: [PATCH 1/3] Replace deprecated Caddyfile syntax This warns for every call to the `subproject` snippet. --- templates/Caddyfile.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/Caddyfile.j2 b/templates/Caddyfile.j2 index 37ba2d5..31cb3f5 100644 --- a/templates/Caddyfile.j2 +++ b/templates/Caddyfile.j2 @@ -3,10 +3,10 @@ (subproject) { # Caddy doesn't know this is a directory, so redirect to trailing / as # would usually happen for them. - redir /{args.0} /{args.0}/ permanent + redir /{args[0]} /{args[0]}/ permanent - handle_path /{args.0}/* { - root * {{ caddy.site_dir }}/{args.0} + handle_path /{args[0]}/* { + root * {{ caddy.site_dir }}/{args[0]} try_files {path}.html {path} file_server { hide .git From 86cd69623175f12df3e4a108e12cb3a9081fd240 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 8 Oct 2024 23:40:27 -0400 Subject: [PATCH 2/3] Move third-party packages to /thirdpartypackages Also, add an alias of `/3pp` and redirect the `/mpl-third-party` path to the new path. --- matplotlib.org.yml | 34 +++++++++++++++++----------------- templates/Caddyfile.j2 | 18 ++++++++++++++---- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/matplotlib.org.yml b/matplotlib.org.yml index e7620d9..7f00cdd 100644 --- a/matplotlib.org.yml +++ b/matplotlib.org.yml @@ -8,21 +8,21 @@ site_dir: "/usr/share/caddy" tls_config: "tls /etc/caddy/tls/cert.pem /etc/caddy/tls/privkey.pem" repos: - - mpl-brochure-site - - matplotlib.github.com - - basemap - - cheatsheets - - cycler - - devdocs - - governance - - ipympl - - matplotblog - - mpl-bench - - mpl-gui - - mpl-sphinx-theme - - mpl-third-party - - pytest-mpl - - data-prototype + mpl-brochure-site: + matplotlib.github.com: + basemap: + cheatsheets: + cycler: + devdocs: + governance: + ipympl: + matplotblog: + mpl-bench: + mpl-gui: + mpl-sphinx-theme: + mpl-third-party: thirdpartypackages + pytest-mpl: + data-prototype: vars_files: - files/webhook_vars.yml tasks: @@ -162,7 +162,7 @@ mode: 0755 owner: caddy group: caddy - loop: "{{ repos }}" + loop: "{{ repos.keys() }}" - name: Clone Git repositories become: true @@ -174,7 +174,7 @@ {{ (item == 'matplotlib.github.com') | ternary('main', 'gh-pages') }} - loop: "{{ repos }}" + loop: "{{ repos.keys() }}" # Caddy server setup # ################## diff --git a/templates/Caddyfile.j2 b/templates/Caddyfile.j2 index 31cb3f5..8becd7f 100644 --- a/templates/Caddyfile.j2 +++ b/templates/Caddyfile.j2 @@ -3,9 +3,9 @@ (subproject) { # Caddy doesn't know this is a directory, so redirect to trailing / as # would usually happen for them. - redir /{args[0]} /{args[0]}/ permanent + redir /{args[1]} /{args[1]}/ permanent - handle_path /{args[0]}/* { + handle_path /{args[1]}/* { root * {{ caddy.site_dir }}/{args[0]} try_files {path}.html {path} file_server { @@ -70,8 +70,8 @@ http://{{ caddy.addresses.main }}, http://{{ ansible_fqdn }} { root * {{ caddy.site_dir }} -{% for site in repos %} - import subproject {{ site }} +{% for site, path in repos.items() %} + import subproject {{ site }} {{ path | default(site, true) }} {% endfor %} # Hide mpl-altair until the site is fixed. @@ -96,6 +96,16 @@ http://{{ caddy.addresses.main }}, http://{{ ansible_fqdn }} { } } + # Redirect the repo-named third-party packages path to the more-generic path. + redir /3pp /thirdpartypackages/ # And also add a shortcut. + @mpl-third-party path /mpl-third-party /mpl-third-party/* + handle @mpl-third-party { + route { + uri strip_prefix /mpl-third-party + redir * /thirdpartypackages{uri} + } + } + # Place the brochure site at the top level. @brochure file { root {{ caddy.site_dir }}/mpl-brochure-site From 08a0ec72f6e1c2c2adc96ba23a6b986cf917f348 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 8 Oct 2024 23:46:09 -0400 Subject: [PATCH 3/3] Redirect old top-level files to versioned docs --- matplotlib.org.yml | 2 ++ templates/Caddyfile.j2 | 64 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/matplotlib.org.yml b/matplotlib.org.yml index 7f00cdd..dee35ab 100644 --- a/matplotlib.org.yml +++ b/matplotlib.org.yml @@ -8,6 +8,8 @@ site_dir: "/usr/share/caddy" tls_config: "tls /etc/caddy/tls/cert.pem /etc/caddy/tls/privkey.pem" repos: + # Key is repo name, value is the site /path/ (which defaults to the repo + # name if not set). mpl-brochure-site: matplotlib.github.com: basemap: diff --git a/templates/Caddyfile.j2 b/templates/Caddyfile.j2 index 8becd7f..fcb7624 100644 --- a/templates/Caddyfile.j2 +++ b/templates/Caddyfile.j2 @@ -114,6 +114,70 @@ http://{{ caddy.addresses.main }}, http://{{ ansible_fqdn }} { rewrite / /mpl-brochure-site/index.html rewrite @brochure /mpl-brochure-site{http.matchers.file.relative} + # Redirect any of the old top-level files to the versioned docs. + redir /citing.html /stable/project/citing.html permanent + redir /contents.html /stable/users/ permanent + redir /downloads.html /stable/users/installing/ permanent + redir /gallery.html /stable/gallery/ permanent + redir /py-modindex.html /stable/py-modindex.html permanent +{# 3.5.0 was the last version to be synced to the top-level directory. + We also try for stable, just to go to the best version possible. #} +{%- with old_versions = [ + "stable", + "3.5.0", + "3.4.3", "3.4.2", "3.4.1", "3.4.0", + "3.3.4", "3.3.3", "3.3.2", "3.3.1", "3.3.0", + "3.2.2", "3.2.1", "3.2.0", + "3.1.3", "3.1.1", "3.1.0", + "3.0.3", "3.0.2", "3.0.0", + "2.2.5", "2.2.4", "2.2.3", "2.2.2", "2.2.0", + "2.1.2", "2.1.1", "2.1.0", + "2.0.2", "2.0.1", "2.0.0", + "1.5.3", "1.5.1", "1.5.0", + "1.4.3", "1.4.2", "1.4.1", "1.4.0", + "1.3.1", "1.3.0", "1.2.1", +] %} +{%- with old_toplevel_dirs = [ + "_downloads", + "_images", + "_modules", + "_panels_static", + "_sources", + "_static", + "api", + "devel", + "examples", + "faq", + "gallery", + "glossary", + "mpl_examples", + "mpl_toolkits", + "plot_directive", + "plot_types", + "pyplots", + "resources", + "tutorials", + "users", +] %} + @old-toplevel-dirs { + path{% for dir in old_toplevel_dirs %} /{{dir}} /{{dir}}/{% endfor +%} + file { + root {{ caddy.site_dir }}/matplotlib.github.com + try_files{% for version in old_versions %} /{{version}}/{path}/index.html{% endfor +%} + } + } + redir @old-toplevel-dirs {http.matchers.file.relative} permanent + @old-toplevel-dir-contents { + path{% for dir in old_toplevel_dirs %} /{{dir}}/*{% endfor +%} + file { + root {{ caddy.site_dir }}/matplotlib.github.com + try_files{% for version in old_versions %} /{{version}}/{path}.html /{{version}}/{path}{% endfor +%} + } + } + redir @old-toplevel-dir-contents {http.matchers.file.relative} permanent +{%- endwith -%} +{%- endwith +%} + # Finally try any of the versioned docs. handle { root * {{ caddy.site_dir }}/matplotlib.github.com pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy