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 Feb 16, 2022
1 parent 2012877 commit b1f9e97
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 69 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 im = images_rotate[ind].image;
st = '<img class="imrot-img" src="_static/images-rotate/' +im+'" />'
var cap = images_rotate[ind].caption;
var link = "https://matplotlib.org/stable/" + images_rotate[ind].link;
var link = "/stable/" + images_rotate[ind].link;
st2 = '<div class="imrot-cap">'+ cap + '</div>'
document.getElementById('image_rotator').innerHTML = '<a href="' + link + '"> ' + st + st2 + '</a>';

Expand Down
16 changes: 6 additions & 10 deletions docs/_templates/landing_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,31 @@ <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></li>
<li>
<a href="https://matplotlib.org/governance/">Governance</a>
</li>
<li><a href="/stable/users/project/license.html">License</a></li>
<li><a href="/governance/">Governance</a></li>
<li><a href="https://numfocus.org/sponsored-projects">NumFOCUS Fiscally Sponsored Project</a></li>
</ul>

<ul class="release-docs grid__release-docs">
<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
109 changes: 52 additions & 57 deletions docs/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,24 @@ <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"
>JupyterLab and Graphical User Interfaces</a
>.
Embed in <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
>
built on Matplotlib.

Use a rich array of <a href="/mpl-third-party/">third-party
packages</a> built on Matplotlib.
</li>
</ul>

Expand All @@ -68,9 +60,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.png"
alt="computer desktop icon"
Expand All @@ -80,7 +70,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.png"
alt="folder icon"
Expand All @@ -90,7 +80,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.png"
alt="documentation book icon"
Expand All @@ -100,7 +90,7 @@ <h1>Matplotlib: Visualization with Python</h1>
</a>
</li>
<li>
<a href="https://matplotlib.org/cheatsheets/">
<a href="/cheatsheets/">
<img
src="_static/images/cheatsheets.png"
alt="cheatsheet icon"
Expand All @@ -110,7 +100,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.png"
alt="matplotlib logo icon"
Expand All @@ -133,12 +123,27 @@ <h1>Matplotlib: Visualization with Python</h1>
<h3>News</h3>
<div class="news__item--highlight">
<h5 class="date">November 15, 2021</h5>
<a href="https://matplotlib.org/stable" class="link--offsite">Matplotlib 3.5.0 Released</a>
<a href="/stable/" class="link--offsite">
Matplotlib 3.5.0 Released
</a>
<p>
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
<a href="https://matplotlib.org/devdocs/users/prev_whats_new/whats_new_3.5.0.html#qt-backends">Qt6</a>.
</p><p>
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.
Highlights include
<a href="/stable/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-colormapping
<a href="/stable/users/prev_whats_new/whats_new_3.5.0.html#image-interpolation-now-possible-at-rgba-stage">
resampling</a>, and support for
<a href="/stable/users/prev_whats_new/whats_new_3.5.0.html#gtk-backend">
GTK4</a> and
<a href="/stable/users/prev_whats_new/whats_new_3.5.0.html#qt-backends">
Qt6</a>.
</p>
<p>
See the <a
href="/stable/users/prev_whats_new/whats_new_3.5.0.html">release
notes</a> and <a
href="/stable/api/prev_api_changes/api_changes_3.5.0.html">API
changes</a> for details.
</p>
</div>

Expand Down Expand Up @@ -176,13 +181,10 @@ <h3>Resources</h3>
<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/">Users guide</a> and
the <a href="/stable/api/">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 @@ -230,9 +232,9 @@ <h3>Domain Specific Tools</h3>
(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 @@ -422,12 +424,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 @@ -442,20 +441,16 @@ <h4>Contribute</h4>
<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
>
(1968&ndash;2012) and the project's <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
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
html_theme = "mpl_sphinx_theme"
html_favicon = "_static/favicon.ico"
html_theme_options = {
"logo_link": "https://matplotlib.org/stable/",
"logo_link": "/stable/",
"native_site": False,
"footer_items": ["landing_footer"],
}
Expand Down

0 comments on commit b1f9e97

Please sign in to comment.