Skip to content

Commit b3caa9f

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 856ecd8 commit b3caa9f

File tree

3 files changed

+34
-47
lines changed

3 files changed

+34
-47
lines changed

docs/_static/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
5151
var info = images_rotate[ind];
5252
var img_src = "_static/images-rotate/" + info.image;
5353
var caption = info.caption;
54-
var link = "https://matplotlib.org/stable/" + info.link;
54+
var link = "/stable/" + info.link;
5555
var html = '<a href="' + link + '">' +
5656
'<img class="imrot-img" src="' + img_src + '" aria-labelledby="sample-plot-caption"/>' +
5757
'<div class="imrot-cap" id="sample-plot-caption">' + caption + '</div>' +

docs/_templates/landing_footer.html

+6-8
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,17 @@ <h1>Matplotlib</h1>
3737
</div>
3838

3939
<ul class="mpl-links grid__mpl-links">
40-
<li><a href="https://matplotlib.org/matplotblog/">Matplotblog</a></li>
40+
<li><a href="/matplotblog/">Matplotblog</a></li>
4141
<li>
4242
<a
4343
href="https://github.com/matplotlib/matplotlib/blob/master/CODE_OF_CONDUCT.md"
4444
>Code of Conduct</a>
4545
</li>
4646
<li>
47-
<a href="https://matplotlib.org/stable/users/project/license.html"
48-
>License</a>
47+
<a href="/stable/users/project/license.html">License</a>
4948
</li>
5049
<li>
51-
<a href="https://matplotlib.org/governance/">Governance</a>
50+
<a href="/governance/">Governance</a>
5251
</li>
5352
<li>
5453
<a href="https://numfocus.org/sponsored-projects"
@@ -60,16 +59,15 @@ <h1>Matplotlib</h1>
6059
<dl class="release">
6160
<dt>Latest Stable Release</dt>
6261
<dd>
63-
<a href="https://matplotlib.org/stable">docs</a> |
64-
<a href="https://matplotlib.org/stable/users/whats_new.html"
65-
>changelog</a>
62+
<a href="/stable">docs</a> |
63+
<a href="/stable/users/whats_new.html">changelog</a>
6664
</dd>
6765
</dl>
6866

6967
<dl class="release">
7068
<dt>Development version</dt>
7169
<dd>
72-
<a href="https://matplotlib.org/devdocs/index.html">docs</a>
70+
<a href="/devdocs/index.html">docs</a>
7371
</dd>
7472
</dl>
7573
</ul>

docs/body.html

+27-38
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,23 @@ <h1>Matplotlib: Visualization with Python</h1>
2020
</li>
2121
<li>
2222
Customize
23-
<a
24-
href="https://matplotlib.org/stable/gallery/style_sheets/style_sheets_reference.html"
25-
>visual style</a> and
26-
<a href="https://matplotlib.org/stable/tutorials/provisional/mosaic.html"
27-
>layout</a>.
23+
<a href="/stable/gallery/style_sheets/style_sheets_reference.html">
24+
visual style
25+
</a> and
26+
<a href="/stable/tutorials/provisional/mosaic.html">layout</a>.
2827
</li>
2928
<li>
30-
Export to
31-
<a href="https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure.savefig"
32-
>many file formats</a>.
29+
Export to <a
30+
href="/stable/api/figure_api.html#matplotlib.figure.Figure.savefig">many
31+
file formats</a>.
3332
</li>
3433
<li>
3534
Embed in
36-
<a href="https://matplotlib.org/stable/gallery/#embedding-matplotlib-in-graphical-user-interfaces"
35+
<a href="/stable/gallery/#embedding-matplotlib-in-graphical-user-interfaces"
3736
>JupyterLab and Graphical User Interfaces</a>.
3837
</li>
3938
<li>
40-
Use a rich array of
41-
<a href="https://matplotlib.org/mpl-third-party/"
42-
>third-party packages</a>
39+
Use a rich array of <a href="/mpl-third-party/">third-party packages</a>
4340
built on Matplotlib.
4441
</li>
4542
</ul>
@@ -59,7 +56,7 @@ <h1>Matplotlib: Visualization with Python</h1>
5956
<section class="grid__quicklinks">
6057
<ul class="quicklinks">
6158
<li>
62-
<a href="https://matplotlib.org/stable/users/getting_started/">
59+
<a href="/stable/users/getting_started/">
6360
<img
6461
src="_static/images/getting-started.svg"
6562
alt="computer desktop icon"
@@ -69,7 +66,7 @@ <h1>Matplotlib: Visualization with Python</h1>
6966
</a>
7067
</li>
7168
<li>
72-
<a href="https://matplotlib.org/stable/plot_types/index.html">
69+
<a href="/stable/plot_types/">
7370
<img
7471
src="_static/images/sample-plots.svg"
7572
alt="folder icon"
@@ -79,7 +76,7 @@ <h1>Matplotlib: Visualization with Python</h1>
7976
</a>
8077
</li>
8178
<li>
82-
<a href="https://matplotlib.org/stable/index.html">
79+
<a href="/stable/">
8380
<img
8481
src="_static/images/userguide.svg"
8582
alt="documentation book icon"
@@ -89,7 +86,7 @@ <h1>Matplotlib: Visualization with Python</h1>
8986
</a>
9087
</li>
9188
<li>
92-
<a href="https://matplotlib.org/cheatsheets/">
89+
<a href="/cheatsheets/">
9390
<img
9491
src="_static/images/cheatsheets.svg"
9592
alt="cheatsheet icon"
@@ -99,7 +96,7 @@ <h1>Matplotlib: Visualization with Python</h1>
9996
</a>
10097
</li>
10198
<li>
102-
<a href="https://matplotlib.org/stable/index.html">
99+
<a href="/stable/">
103100
<img
104101
src="_static/images/documentation.svg"
105102
alt="matplotlib logo icon"
@@ -158,13 +155,10 @@ <h3>Resources<a class ="headerlink" href="#resources" title="Permalink to resour
158155
<div class="callout__list">
159156
<i class="far fa-question-circle callout__icon"></i>
160157
<p>
161-
Be sure to check the
162-
<a href="https://matplotlib.org/stable/users/index.html">Users
163-
guide</a> and the
164-
<a href="https://matplotlib.org/stable/api/index.html">API
165-
docs</a>. The full text
166-
<a href="https://matplotlib.org/stable/search.html">search</a> is a
167-
good way to discover the docs including the many examples.
158+
Be sure to check the <a href="/stable/users/index.html">Users guide</a> and
159+
the <a href="/stable/api/index.html">API docs</a>. The full text <a
160+
href="/stable/search.html">search</a> is a good way to discover the docs
161+
including the many examples.
168162
</p>
169163
</div>
170164

@@ -218,9 +212,9 @@ <h3>Domain Specific Tools<a class="headerlink" href="#domain-specific-tools" tit
218212
(seaborn, HoloViews, ggplot, ...), and a projection and mapping
219213
toolkit (Cartopy).
220214
</p>
221-
<a href="https://matplotlib.org/mpl-third-party/" class="link--offsite"
222-
>More Domain-Specific Tools</a
223-
>
215+
<a href="/mpl-third-party/" class="link--offsite">
216+
More Domain-Specific Tools
217+
</a>
224218
</section>
225219

226220
<!-- tool switcher -->
@@ -405,11 +399,9 @@ <h4>Contribute</h4>
405399
You can help by answering questions
406400
<a href="https://discourse.matplotlib.org">on discourse</a>,
407401
reporting a bug or requesting a feature
408-
<a href="https://github.com/matplotlib/matplotlib/issues"
409-
>on GitHub</a
410-
>, or improving the
411-
<a href="https://matplotlib.org/stable/devel/index.html"
412-
>documentation and code</a>!
402+
<a href="https://github.com/matplotlib/matplotlib/issues">on GitHub</a>,
403+
or improving the
404+
<a href="/stable/devel/index.html">documentation and code</a>!
413405
</p>
414406
<a href="https://discourse.matplotlib.org" class="link--offsite"
415407
>Join us on Discourse</a>
@@ -423,17 +415,14 @@ <h4>Cite</h4>
423415
<p>
424416
Matplotlib is the result of development efforts by John Hunter
425417
(1968&ndash;2012) and the project's
426-
<a href="https://matplotlib.org/stable/users/project/credits.html"
427-
>many contributors</a>.
418+
<a href="/stable/users/project/credits.html">many contributors</a>.
428419
</p>
429420
<p>
430421
If Matplotlib contributes to a project that leads to a scientific
431422
publication, please acknowledge this work by citing the project!
432423
</p>
433-
<a
434-
href="https://matplotlib.org/stable/users/project/citing.html"
435-
class="link--offsite"
436-
>Ready made citation</a>
424+
<a href="/stable/users/project/citing.html" class="link--offsite">Ready
425+
made citation</a>
437426
</li>
438427
<li class="callout callout--teal">
439428
<h4>Donate</h4>

0 commit comments

Comments
 (0)