Switch docs theme to Furo, refs #1746

This commit is contained in:
Simon Willison 2022-05-20 13:34:51 -07:00
commit 1d33fd03b3
10 changed files with 72 additions and 84 deletions

6
docs/_templates/base.html vendored Normal file
View file

@ -0,0 +1,6 @@
{%- extends "!base.html" %}
{% block site_meta %}
{{ super() }}
<script defer data-domain="docs.datasette.io" src="https://plausible.io/js/plausible.js"></script>
{% endblock %}

View file

@ -1,61 +0,0 @@
{%- extends "!layout.html" %}
{% block htmltitle %}
{{ super() }}
<script defer data-domain="docs.datasette.io" src="https://plausible.io/js/plausible.js"></script>
{% endblock %}
{% block sidebartitle %}
<a href="https://datasette.io/">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
</a>
{% if theme_display_version %}
{%- set nav_version = version %}
{% if READTHEDOCS and current_version %}
{%- set nav_version = current_version %}
{% endif %}
{% if nav_version %}
<div class="version">
{{ nav_version }}
</div>
{% endif %}
{% endif %}
{% include "searchbox.html" %}
{% endblock %}
{% block footer %}
{{ super() }}
<script>
jQuery(function ($) {
// Show banner linking to /stable/ if this is a /latest/ page
if (!/\/latest\//.test(location.pathname)) {
return;
}
var stableUrl = location.pathname.replace("/latest/", "/stable/");
// Check it's not a 404
fetch(stableUrl, { method: "HEAD" }).then((response) => {
if (response.status == 200) {
var warning = $(
`<div class="admonition warning">
<p class="first admonition-title">Note</p>
<p class="last">
This documentation covers the <strong>development version</strong> of Datasette.</p>
<p>See <a href="${stableUrl}">this page</a> for the current stable release.
</p>
</div>`
);
warning.find("a").attr("href", stableUrl);
var body = $("div.body");
if (!body.length) {
body = $("div.document");
}
body.prepend(warning);
}
});
});
</script>
{% endblock %}

16
docs/_templates/sidebar/brand.html vendored Normal file
View file

@ -0,0 +1,16 @@
<div class="sidebar-brand centered">
{% block brand_content %}
<div class="sidebar-logo-container">
<a href="https://datasette.io/"><img class="sidebar-logo" src="{{ logo_url }}" alt="Datasette"></a>
</div>
{%- set nav_version = version %}
{% if READTHEDOCS and current_version %}
{%- set nav_version = current_version %}
{% endif %}
{% if nav_version %}
<div class="version">
{{ nav_version }}
</div>
{% endif %}
{% endblock brand_content %}
</div>

11
docs/_templates/sidebar/navigation.html vendored Normal file
View file

@ -0,0 +1,11 @@
<div class="sidebar-tree">
<ul>
<li class="toctree-l1"><a class="reference internal" href="{{ pathto(master_doc) }}">Contents</a></li>
</ul>
{{ toctree(
collapse=True,
titles_only=False,
maxdepth=3,
includehidden=True,
) }}
</div>