Closed simonw closed 2 years ago
On https://readthedocs.org/dashboard/sqlite-utils/advanced/ I checked this box (previously unchecked):
While I'm modifying that template I'm also going to add Plausible analytics:
<script defer data-domain="sqlite-utils.datasette.io" src="https://plausible.io/js/plausible.js"></script>
https://sqlite-utils.datasette.io/en/3.20/ now also shows the version warning banner.
This broke on the upgrade to Furo.
I fixed it in Datasette like this: https://github.com/simonw/datasette/commit/5c1cfa451d78e3935193f5e10eba59bf741241a1 and https://github.com/simonw/datasette/commit/db8cf899e286fbaa0a40f3a9ae8d5aaa1478822e
Actually final Datasette fix was:
{% block scripts %}
{{ super() }}
<script>
document.addEventListener("DOMContentLoaded", 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 = document.createElement("div");
warning.className = "admonition warning";
warning.innerHTML = `
<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>
`;
var mainArticle = document.querySelector("article[role=main]");
mainArticle.insertBefore(warning, mainArticle.firstChild);
}
});
});
</script>
{% endblock %}
https://sqlite-utils.datasette.io/en/2.14.1/ isn't showing a link to the stable release right now.
I should also apply the same fix I used for Datasette in:
TIL: https://til.simonwillison.net/readthedocs/link-from-latest-to-stable