Skip to content

Commit b1f9e97

Browse files
committed
Make stable documentation links server-absolute
... instead of globally absolute with an explicit server name. This allows the docs to be served from a different server (e.g., on localhost if you have everything checked out together), without links leaking out to the real matplotlib.org.
1 parent 2012877 commit b1f9e97

File tree

4 files changed

+60
-69
lines changed

4 files changed

+60
-69
lines changed

docs/_static/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
5151
var im = images_rotate[ind].image;
5252
st = '<img class="imrot-img" src="_static/images-rotate/' +im+'" />'
5353
var cap = images_rotate[ind].caption;
54-
var link = "https://matplotlib.org/stable/" + images_rotate[ind].link;
54+
var link = "/stable/" + images_rotate[ind].link;
5555
st2 = '<div class="imrot-cap">'+ cap + '</div>'
5656
document.getElementById('image_rotator').innerHTML = '<a href="' + link + '"> ' + st + st2 + '</a>';
5757

docs/_templates/landing_footer.html

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,35 +38,31 @@ <h1>Matplotlib</h1>
3838
</div>
3939

4040
<ul class="mpl-links grid__mpl-links">
41-
<li><a href="https://matplotlib.org/matplotblog/">Matplotblog</a></li>
41+
<li><a href="/matplotblog/">Matplotblog</a></li>
4242
<li>
4343
<a
4444
href="https://github.com/matplotlib/matplotlib/blob/master/CODE_OF_CONDUCT.md"
4545
>Code of Conduct</a
4646
>
4747
</li>
48-
<li><a href="https://matplotlib.org/stable/users/project/license.html">License</a></li>
49-
<li>
50-
<a href="https://matplotlib.org/governance/">Governance</a>
51-
</li>
48+
<li><a href="/stable/users/project/license.html">License</a></li>
49+
<li><a href="/governance/">Governance</a></li>
5250
<li><a href="https://numfocus.org/sponsored-projects">NumFOCUS Fiscally Sponsored Project</a></li>
5351
</ul>
5452

5553
<ul class="release-docs grid__release-docs">
5654
<dl class="release">
5755
<dt>Latest Stable Release</dt>
5856
<dd>
59-
<a href="https://matplotlib.org/stable">docs</a> |
60-
<a href="https://matplotlib.org/stable/users/whats_new.html"
61-
>changelog</a
62-
>
57+
<a href="/stable/">docs</a> |
58+
<a href="/stable/users/whats_new.html">changelog</a>
6359
</dd>
6460
</dl>
6561

6662
<dl class="release">
6763
<dt>Development version</dt>
6864
<dd>
69-
<a href="https://matplotlib.org/devdocs/index.html">docs</a>
65+
<a href="/devdocs/index.html">docs</a>
7066
</dd>
7167
</dl>
7268
</ul>

docs/body.html

Lines changed: 52 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,24 @@ <h1>Matplotlib: Visualization with Python</h1>
2323
</li>
2424
<li>
2525
Customize
26-
<a
27-
href="https://matplotlib.org/stable/gallery/style_sheets/style_sheets_reference.html"
28-
>visual style</a> and
29-
<a href="https://matplotlib.org/stable/tutorials/provisional/mosaic.html"
30-
>layout</a>.
26+
<a href="/stable/gallery/style_sheets/style_sheets_reference.html">
27+
visual style
28+
</a> and
29+
<a href="/stable/tutorials/provisional/mosaic.html">layout</a>.
3130
</li>
3231
<li>
33-
Export to
34-
<a href="https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure.savefig"
35-
>many file formats</a
36-
>
37-
.
32+
Export to <a
33+
href="/stable/api/figure_api.html#matplotlib.figure.Figure.savefig">
34+
many file formats</a>.
3835
</li>
3936
<li>
40-
Embed in
41-
<a href="https://matplotlib.org/stable/gallery/#embedding-matplotlib-in-graphical-user-interfaces"
42-
>JupyterLab and Graphical User Interfaces</a
43-
>.
37+
Embed in <a
38+
href="/stable/gallery/#embedding-matplotlib-in-graphical-user-interfaces">
39+
JupyterLab and Graphical User Interfaces</a>.
4440
</li>
4541
<li>
46-
Use a rich array of
47-
<a href="https://matplotlib.org/mpl-third-party/"
48-
>third-party packages</a
49-
>
50-
built on Matplotlib.
51-
42+
Use a rich array of <a href="/mpl-third-party/">third-party
43+
packages</a> built on Matplotlib.
5244
</li>
5345
</ul>
5446

@@ -68,9 +60,7 @@ <h1>Matplotlib: Visualization with Python</h1>
6860
<section class="grid__quicklinks">
6961
<ul class="quicklinks">
7062
<li>
71-
<a
72-
href="https://matplotlib.org/stable/users/getting_started/"
73-
>
63+
<a href="/stable/users/getting_started/">
7464
<img
7565
src="_static/images/getting-started.png"
7666
alt="computer desktop icon"
@@ -80,7 +70,7 @@ <h1>Matplotlib: Visualization with Python</h1>
8070
</a>
8171
</li>
8272
<li>
83-
<a href="https://matplotlib.org/stable/plot_types/index.html">
73+
<a href="/stable/plot_types/">
8474
<img
8575
src="_static/images/sample-plots.png"
8676
alt="folder icon"
@@ -90,7 +80,7 @@ <h1>Matplotlib: Visualization with Python</h1>
9080
</a>
9181
</li>
9282
<li>
93-
<a href="https://matplotlib.org/stable/index.html">
83+
<a href="/stable/">
9484
<img
9585
src="_static/images/userguide.png"
9686
alt="documentation book icon"
@@ -100,7 +90,7 @@ <h1>Matplotlib: Visualization with Python</h1>
10090
</a>
10191
</li>
10292
<li>
103-
<a href="https://matplotlib.org/cheatsheets/">
93+
<a href="/cheatsheets/">
10494
<img
10595
src="_static/images/cheatsheets.png"
10696
alt="cheatsheet icon"
@@ -110,7 +100,7 @@ <h1>Matplotlib: Visualization with Python</h1>
110100
</a>
111101
</li>
112102
<li>
113-
<a href="https://matplotlib.org/stable/index.html">
103+
<a href="/stable/">
114104
<img
115105
src="_static/images/documentation.png"
116106
alt="matplotlib logo icon"
@@ -133,12 +123,27 @@ <h1>Matplotlib: Visualization with Python</h1>
133123
<h3>News</h3>
134124
<div class="news__item--highlight">
135125
<h5 class="date">November 15, 2021</h5>
136-
<a href="https://matplotlib.org/stable" class="link--offsite">Matplotlib 3.5.0 Released</a>
126+
<a href="/stable/" class="link--offsite">
127+
Matplotlib 3.5.0 Released
128+
</a>
137129
<p>
138-
Highlights include <a href="https://matplotlib.org/devdocs/users/prev_whats_new/whats_new_3.5.0.html#subplot-mosaic-supports-simple-axes-sharing">shared axes in <span class="pre">subplot_mosaic</span></a>, post-colormaping <a href="https://matplotlib.org/devdocs/users/prev_whats_new/whats_new_3.5.0.html#image-interpolation-now-possible-at-rgba-stage"> resampling</a>, and support for <a href="https://matplotlib.org/devdocs/users/prev_whats_new/whats_new_3.5.0.html#gtk-backend">GTK4</a> and
139-
<a href="https://matplotlib.org/devdocs/users/prev_whats_new/whats_new_3.5.0.html#qt-backends">Qt6</a>.
140-
</p><p>
141-
See the <a href="https://matplotlib.org/devdocs/users/prev_whats_new/whats_new_3.5.0.html">release notes</a> and <a href="https://matplotlib.org/devdocs/api/prev_api_changes/api_changes_3.5.0.html">API changes</a> for details.
130+
Highlights include
131+
<a href="/stable/users/prev_whats_new/whats_new_3.5.0.html#subplot-mosaic-supports-simple-axes-sharing">
132+
shared axes in <span class="pre">subplot_mosaic</span></a>,
133+
post-colormapping
134+
<a href="/stable/users/prev_whats_new/whats_new_3.5.0.html#image-interpolation-now-possible-at-rgba-stage">
135+
resampling</a>, and support for
136+
<a href="/stable/users/prev_whats_new/whats_new_3.5.0.html#gtk-backend">
137+
GTK4</a> and
138+
<a href="/stable/users/prev_whats_new/whats_new_3.5.0.html#qt-backends">
139+
Qt6</a>.
140+
</p>
141+
<p>
142+
See the <a
143+
href="/stable/users/prev_whats_new/whats_new_3.5.0.html">release
144+
notes</a> and <a
145+
href="/stable/api/prev_api_changes/api_changes_3.5.0.html">API
146+
changes</a> for details.
142147
</p>
143148
</div>
144149

@@ -176,13 +181,10 @@ <h3>Resources</h3>
176181
<div class="callout__list">
177182
<i class="far fa-question-circle callout__icon"></i>
178183
<p>
179-
Be sure to check the
180-
<a href="https://matplotlib.org/stable/users/index.html">Users
181-
guide</a> and the
182-
<a href="https://matplotlib.org/stable/api/index.html">API docs</a
183-
>. The full text
184-
<a href="https://matplotlib.org/stable/search.html">search</a> is a
185-
good way to discover the docs including the many examples.
184+
Be sure to check the <a href="/stable/users/">Users guide</a> and
185+
the <a href="/stable/api/">API docs</a>. The full text
186+
<a href="/stable/search.html">search</a> is a good way to
187+
discover the docs including the many examples.
186188
</p>
187189
</div>
188190

@@ -230,9 +232,9 @@ <h3>Domain Specific Tools</h3>
230232
(seaborn, HoloViews, ggplot, ...), and a projection and mapping
231233
toolkit (Cartopy).
232234
</p>
233-
<a href="https://matplotlib.org/mpl-third-party/" class="link--offsite"
234-
>More Domain-Specific Tools</a
235-
>
235+
<a href="/mpl-third-party/" class="link--offsite">
236+
More Domain-Specific Tools
237+
</a>
236238
</section>
237239

238240
<!-- tool switcher -->
@@ -422,12 +424,9 @@ <h4>Contribute</h4>
422424
You can help by answering questions
423425
<a href="https://discourse.matplotlib.org">on discourse</a>,
424426
reporting a bug or requesting a feature
425-
<a href="https://github.com/matplotlib/matplotlib/issues"
426-
>on GitHub</a
427-
>, or improving the
428-
<a href="https://matplotlib.org/stable/devel/index.html"
429-
>documentation and code</a
430-
>!
427+
<a href="https://github.com/matplotlib/matplotlib/issues">on
428+
GitHub</a>, or improving the <a
429+
href="/stable/devel/index.html">documentation and code</a>!
431430
</p>
432431
<a href="https://discourse.matplotlib.org" class="link--offsite"
433432
>Join us on Discourse</a
@@ -442,20 +441,16 @@ <h4>Contribute</h4>
442441
<h4>Cite</h4>
443442
<p>
444443
Matplotlib is the result of development efforts by John Hunter
445-
(1968&ndash;2012) and the project's
446-
<a href="https://matplotlib.org/stable/users/project/credits.html"
447-
>many contributors.</a
448-
>
444+
(1968&ndash;2012) and the project's <a
445+
href="/stable/users/project/credits.html">many contributors</a>.
449446
</p>
450447
<p>
451448
If Matplotlib contributes to a project that leads to a scientific
452449
publication, please acknowledge this work by citing the project!
453450
</p>
454-
<a
455-
href="https://matplotlib.org/stable/users/project/citing.html"
456-
class="link--offsite"
457-
>Ready made citation</a
458-
>
451+
<a href="/stable/users/project/citing.html" class="link--offsite">
452+
Ready made citation
453+
</a>
459454
</li>
460455
<li class="callout callout--teal">
461456
<h4>Donate</h4>

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
html_theme = "mpl_sphinx_theme"
3232
html_favicon = "_static/favicon.ico"
3333
html_theme_options = {
34-
"logo_link": "https://matplotlib.org/stable/",
34+
"logo_link": "/stable/",
3535
"native_site": False,
3636
"footer_items": ["landing_footer"],
3737
}

0 commit comments

Comments
 (0)