Skip to content

Commit

Permalink
Make stable documentation links server-absolute
Browse files Browse the repository at this point in the history
... 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.
  • Loading branch information
QuLogic committed Apr 12, 2023
1 parent 856ecd8 commit b3caa9f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docs/_static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
var info = images_rotate[ind];
var img_src = "_static/images-rotate/" + info.image;
var caption = info.caption;
var link = "https://matplotlib.org/stable/" + info.link;
var link = "/stable/" + info.link;
var html = '<a href="' + link + '">' +
'<img class="imrot-img" src="' + img_src + '" aria-labelledby="sample-plot-caption"/>' +
'<div class="imrot-cap" id="sample-plot-caption">' + caption + '</div>' +
Expand Down
14 changes: 6 additions & 8 deletions docs/_templates/landing_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,17 @@ <h1>Matplotlib</h1>
</div>

<ul class="mpl-links grid__mpl-links">
<li><a href="https://matplotlib.org/matplotblog/">Matplotblog</a></li>
<li><a href="/matplotblog/">Matplotblog</a></li>
<li>
<a
href="https://github.com/matplotlib/matplotlib/blob/master/CODE_OF_CONDUCT.md"
>Code of Conduct</a>
</li>
<li>
<a href="https://matplotlib.org/stable/users/project/license.html"
>License</a>
<a href="/stable/users/project/license.html">License</a>
</li>
<li>
<a href="https://matplotlib.org/governance/">Governance</a>
<a href="/governance/">Governance</a>
</li>
<li>
<a href="https://numfocus.org/sponsored-projects"
Expand All @@ -60,16 +59,15 @@ <h1>Matplotlib</h1>
<dl class="release">
<dt>Latest Stable Release</dt>
<dd>
<a href="https://matplotlib.org/stable">docs</a> |
<a href="https://matplotlib.org/stable/users/whats_new.html"
>changelog</a>
<a href="/stable">docs</a> |
<a href="/stable/users/whats_new.html">changelog</a>
</dd>
</dl>

<dl class="release">
<dt>Development version</dt>
<dd>
<a href="https://matplotlib.org/devdocs/index.html">docs</a>
<a href="/devdocs/index.html">docs</a>
</dd>
</dl>
</ul>
Expand Down
65 changes: 27 additions & 38 deletions docs/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,23 @@ <h1>Matplotlib: Visualization with Python</h1>
</li>
<li>
Customize
<a
href="https://matplotlib.org/stable/gallery/style_sheets/style_sheets_reference.html"
>visual style</a> and
<a href="https://matplotlib.org/stable/tutorials/provisional/mosaic.html"
>layout</a>.
<a href="/stable/gallery/style_sheets/style_sheets_reference.html">
visual style
</a> and
<a href="/stable/tutorials/provisional/mosaic.html">layout</a>.
</li>
<li>
Export to
<a href="https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure.savefig"
>many file formats</a>.
Export to <a
href="/stable/api/figure_api.html#matplotlib.figure.Figure.savefig">many
file formats</a>.
</li>
<li>
Embed in
<a href="https://matplotlib.org/stable/gallery/#embedding-matplotlib-in-graphical-user-interfaces"
<a href="/stable/gallery/#embedding-matplotlib-in-graphical-user-interfaces"
>JupyterLab and Graphical User Interfaces</a>.
</li>
<li>
Use a rich array of
<a href="https://matplotlib.org/mpl-third-party/"
>third-party packages</a>
Use a rich array of <a href="/mpl-third-party/">third-party packages</a>
built on Matplotlib.
</li>
</ul>
Expand All @@ -59,7 +56,7 @@ <h1>Matplotlib: Visualization with Python</h1>
<section class="grid__quicklinks">
<ul class="quicklinks">
<li>
<a href="https://matplotlib.org/stable/users/getting_started/">
<a href="/stable/users/getting_started/">
<img
src="_static/images/getting-started.svg"
alt="computer desktop icon"
Expand All @@ -69,7 +66,7 @@ <h1>Matplotlib: Visualization with Python</h1>
</a>
</li>
<li>
<a href="https://matplotlib.org/stable/plot_types/index.html">
<a href="/stable/plot_types/">
<img
src="_static/images/sample-plots.svg"
alt="folder icon"
Expand All @@ -79,7 +76,7 @@ <h1>Matplotlib: Visualization with Python</h1>
</a>
</li>
<li>
<a href="https://matplotlib.org/stable/index.html">
<a href="/stable/">
<img
src="_static/images/userguide.svg"
alt="documentation book icon"
Expand All @@ -89,7 +86,7 @@ <h1>Matplotlib: Visualization with Python</h1>
</a>
</li>
<li>
<a href="https://matplotlib.org/cheatsheets/">
<a href="/cheatsheets/">
<img
src="_static/images/cheatsheets.svg"
alt="cheatsheet icon"
Expand All @@ -99,7 +96,7 @@ <h1>Matplotlib: Visualization with Python</h1>
</a>
</li>
<li>
<a href="https://matplotlib.org/stable/index.html">
<a href="/stable/">
<img
src="_static/images/documentation.svg"
alt="matplotlib logo icon"
Expand Down Expand Up @@ -158,13 +155,10 @@ <h3>Resources<a class ="headerlink" href="#resources" title="Permalink to resour
<div class="callout__list">
<i class="far fa-question-circle callout__icon"></i>
<p>
Be sure to check the
<a href="https://matplotlib.org/stable/users/index.html">Users
guide</a> and the
<a href="https://matplotlib.org/stable/api/index.html">API
docs</a>. The full text
<a href="https://matplotlib.org/stable/search.html">search</a> is a
good way to discover the docs including the many examples.
Be sure to check the <a href="/stable/users/index.html">Users guide</a> and
the <a href="/stable/api/index.html">API docs</a>. The full text <a
href="/stable/search.html">search</a> is a good way to discover the docs
including the many examples.
</p>
</div>

Expand Down Expand Up @@ -218,9 +212,9 @@ <h3>Domain Specific Tools<a class="headerlink" href="#domain-specific-tools" tit
(seaborn, HoloViews, ggplot, ...), and a projection and mapping
toolkit (Cartopy).
</p>
<a href="https://matplotlib.org/mpl-third-party/" class="link--offsite"
>More Domain-Specific Tools</a
>
<a href="/mpl-third-party/" class="link--offsite">
More Domain-Specific Tools
</a>
</section>

<!-- tool switcher -->
Expand Down Expand Up @@ -405,11 +399,9 @@ <h4>Contribute</h4>
You can help by answering questions
<a href="https://discourse.matplotlib.org">on discourse</a>,
reporting a bug or requesting a feature
<a href="https://github.com/matplotlib/matplotlib/issues"
>on GitHub</a
>, or improving the
<a href="https://matplotlib.org/stable/devel/index.html"
>documentation and code</a>!
<a href="https://github.com/matplotlib/matplotlib/issues">on GitHub</a>,
or improving the
<a href="/stable/devel/index.html">documentation and code</a>!
</p>
<a href="https://discourse.matplotlib.org" class="link--offsite"
>Join us on Discourse</a>
Expand All @@ -423,17 +415,14 @@ <h4>Cite</h4>
<p>
Matplotlib is the result of development efforts by John Hunter
(1968&ndash;2012) and the project's
<a href="https://matplotlib.org/stable/users/project/credits.html"
>many contributors</a>.
<a href="/stable/users/project/credits.html">many contributors</a>.
</p>
<p>
If Matplotlib contributes to a project that leads to a scientific
publication, please acknowledge this work by citing the project!
</p>
<a
href="https://matplotlib.org/stable/users/project/citing.html"
class="link--offsite"
>Ready made citation</a>
<a href="/stable/users/project/citing.html" class="link--offsite">Ready
made citation</a>
</li>
<li class="callout callout--teal">
<h4>Donate</h4>
Expand Down

0 comments on commit b3caa9f

Please sign in to comment.