{"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1484276946", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1484276946, "node_id": "IC_kwDOBm6k_c5YeETS", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-03-26T23:41:11Z", "updated_at": "2023-03-26T23:41:11Z", "author_association": "OWNER", "body": "It's working again now: https://docs.datasette.io/en/latest/sql_queries.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1484274796", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1484274796, "node_id": "IC_kwDOBm6k_c5YeDxs", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-03-26T23:38:18Z", "updated_at": "2023-03-26T23:38:18Z", "author_association": "OWNER", "body": "ChatGPT prompt:\r\n\r\n> ```\r\n> jQuery(function ($) {\r\n> // Show banner linking to /stable/ if this is a /latest/ page\r\n> if (!/\\/latest\\//.test(location.pathname)) {\r\n> return;\r\n> }\r\n> var stableUrl = location.pathname.replace(\"/latest/\", \"/stable/\");\r\n> // Check it's not a 404\r\n> fetch(stableUrl, { method: \"HEAD\" }).then((response) => {\r\n> if (response.status == 200) {\r\n> var warning = $(\r\n> `
\r\n>

Note

\r\n>

\r\n> This documentation covers the development version of Datasette.

\r\n>

See this page for the current stable release.\r\n>

\r\n>
`\r\n> );\r\n> warning.find(\"a\").attr(\"href\", stableUrl);\r\n> $(\"article[role=main]\").prepend(warning);\r\n> }\r\n> });\r\n> });\r\n> \r\n> Rewrite this to use vanilla JavaScript, no jQuery\r\n> ```\r\n\r\nGot back:\r\n\r\n```javascript\r\ndocument.addEventListener(\"DOMContentLoaded\", function() {\r\n // Show banner linking to /stable/ if this is a /latest/ page\r\n if (!/\\/latest\\//.test(location.pathname)) {\r\n return;\r\n }\r\n var stableUrl = location.pathname.replace(\"/latest/\", \"/stable/\");\r\n // Check it's not a 404\r\n fetch(stableUrl, { method: \"HEAD\" }).then((response) => {\r\n if (response.status === 200) {\r\n var warning = document.createElement(\"div\");\r\n warning.className = \"admonition warning\";\r\n warning.innerHTML = `\r\n

Note

\r\n

\r\n This documentation covers the development version of Datasette.\r\n

\r\n

\r\n See this page for the current stable release.\r\n

\r\n `;\r\n var mainArticle = document.querySelector(\"article[role=main]\");\r\n mainArticle.insertBefore(warning, mainArticle.firstChild);\r\n }\r\n });\r\n});\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1484272313", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1484272313, "node_id": "IC_kwDOBm6k_c5YeDK5", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-03-26T23:36:17Z", "updated_at": "2023-03-26T23:36:17Z", "author_association": "OWNER", "body": "Still getting this error:\r\n\r\n\"image\"\r\n\r\nWeird because `jQuery` is present in the devtools console.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1484270067", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1484270067, "node_id": "IC_kwDOBm6k_c5YeCnz", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-03-26T23:26:10Z", "updated_at": "2023-03-26T23:27:42Z", "author_association": "OWNER", "body": "That didn't work, because `jQuery` isn't yet defined that high up the template.\r\n\r\nI should use `{% block scripts %}` instead: https://github.com/pradyunsg/furo/blob/05350110cf02d033ebb57147eb54e9371a63545a/src/furo/theme/furo/base.html#L89-L102", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1484268146", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1484268146, "node_id": "IC_kwDOBm6k_c5YeCJy", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-03-26T23:23:22Z", "updated_at": "2023-03-26T23:23:22Z", "author_association": "OWNER", "body": "This broke when I upgraded to the Furo theme.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1018017637", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1018017637, "node_id": "IC_kwDOBm6k_c48rbdl", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T23:27:59Z", "updated_at": "2022-01-20T23:27:59Z", "author_association": "OWNER", "body": "Got a couple of TILs out of this:\r\n\r\n- [Promoting the stable version of the documentation using rel=canonical](https://til.simonwillison.net/readthedocs/documentation-seo-canonical)\r\n- [Linking from /latest/ to /stable/ on Read The Docs](https://til.simonwillison.net/readthedocs/link-from-latest-to-stable)", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017998993", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017998993, "node_id": "IC_kwDOBm6k_c48rW6R", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:56:00Z", "updated_at": "2022-01-20T22:56:00Z", "author_association": "OWNER", "body": "> https://sphinx-version-warning.readthedocs.io/ looks like it can show a banner for \"You are looking at v0.36 but you should be looking at 0.40\" but doesn't hand the case I need here which is \"you are looking at /latest/ but you should be looking at /stable/\".\r\n\r\nCorrection! That tool DOES support that, as can be seen in their example configuration for their own documentation:\r\n\r\nhttps://github.com/humitos/sphinx-version-warning/blob/a82156c2ea08e5feab406514d0ccd9d48a345f48/docs/conf.py#L32-L38\r\n\r\n```python\r\nversionwarning_messages = {\r\n 'latest': 'This is a custom message only for version \"latest\" of this documentation.',\r\n}\r\nversionwarning_admonition_type = 'tip'\r\nversionwarning_banner_title = 'Tip'\r\nversionwarning_body_selector = 'div[itemprop=\"articleBody\"]'\r\n```", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017994925", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017994925, "node_id": "IC_kwDOBm6k_c48rV6t", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:48:43Z", "updated_at": "2022-01-20T22:54:02Z", "author_association": "OWNER", "body": "https://sphinx-version-warning.readthedocs.io/ looks like it can show a banner for \"You are looking at v0.36 but you should be looking at 0.40\" but doesn't hand the case I need here which is \"you are looking at /latest/ but you should be looking at /stable/\".\r\n\r\nJust shipped my fix here: https://docs.datasette.io/en/latest/\r\n\r\n\"image\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017993482", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017993482, "node_id": "IC_kwDOBm6k_c48rVkK", "user": {"value": 316517, "label": "astrojuanlu"}, "created_at": "2022-01-20T22:46:16Z", "updated_at": "2022-01-20T22:46:16Z", "author_association": "NONE", "body": "Or you can use https://sphinx-version-warning.readthedocs.io/! \ud83d\ude04 ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017988556", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017988556, "node_id": "IC_kwDOBm6k_c48rUXM", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:37:51Z", "updated_at": "2022-01-20T22:37:51Z", "author_association": "OWNER", "body": "Here's a jQuery recipe that seems to do the right thing:\r\n```javascript\r\njQuery(function ($) {\r\n // If this is a /latest/ doc page, show banner linking to /stable/\r\n if (!/\\/latest\\//.test(location.pathname)) {\r\n return;\r\n }\r\n var stableUrl = location.pathname.replace(\"/latest/\", \"/stable/\");\r\n // Check it's not a 404\r\n fetch(stableUrl, { method: \"HEAD\" }).then((response) => {\r\n if (response.status == 200) {\r\n var warning = $(\r\n `
\r\n

Note

\r\n

\r\n This documentation covers the development version of Datasette.

\r\n

See this page for the current stable release.\r\n

\r\n
`\r\n );\r\n warning.find(\"a\").attr(\"href\", stableUrl);\r\n var body = $(\"div.body\");\r\n if (!body.length) {\r\n body = $(\"div.document\");\r\n }\r\n body.prepend(warning);\r\n }\r\n });\r\n});\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017975322", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017975322, "node_id": "IC_kwDOBm6k_c48rRIa", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:17:01Z", "updated_at": "2022-01-20T22:27:07Z", "author_association": "OWNER", "body": "Turns out that banner is something that ReadTheDocs implemented - I found it using GitHub code search, it's produced by this piece of JavaScript: https://github.com/readthedocs/readthedocs.org/blob/0852d7c10d725d954d3e9a93513171baa1116d9f/readthedocs/core/static-src/core/js/doc-embed/version-compare.js#L13-L21\r\n\r\n```javascript\r\nfunction init(data) {\r\n var rtd = rtddata.get();\r\n\r\n /// Out of date message\r\n\r\n if (data.is_highest) {\r\n return;\r\n }\r\n\r\n var currentURL = window.location.pathname.replace(rtd['version'], data.slug);\r\n var warning = $(\r\n '
' +\r\n '

Note

' +\r\n '

' +\r\n 'You are not reading the most recent version of this documentation. ' +\r\n ' is the latest version available.' +\r\n '

' +\r\n '
');\r\n\r\n warning\r\n .find('a')\r\n .attr('href', currentURL)\r\n .text(data.slug);\r\n\r\n var body = $(\"div.body\");\r\n if (!body.length) {\r\n body = $(\"div.document\");\r\n }\r\n body.prepend(warning);\r\n}\r\n```\r\n\r\nAnd here's where that module is called from the rest of their code: https://github.com/readthedocs/readthedocs.org/blob/bc3e147770e5740314a8e8c33fec5d111c850498/readthedocs/core/static-src/core/js/doc-embed/footer.js#L66-L86", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017981599", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017981599, "node_id": "IC_kwDOBm6k_c48rSqf", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:26:32Z", "updated_at": "2022-01-20T22:26:32Z", "author_association": "OWNER", "body": "I'm tempted to imitate their JavaScript but check for `/latest/` in the URL and use that to append a similar message warning about this being the documentation for the in-development version.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017971905", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017971905, "node_id": "IC_kwDOBm6k_c48rQTB", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:11:40Z", "updated_at": "2022-01-20T22:11:40Z", "author_association": "OWNER", "body": "Huh, I had forgotten I already have a banner on older versions:\r\n\r\n![D1A65C68-9A37-4FA2-80C4-534739A9D292](https://user-images.githubusercontent.com/9599/150430410-1e22e23f-ed27-4271-89ff-63467eb5f466.jpeg)\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017970132", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017970132, "node_id": "IC_kwDOBm6k_c48rP3U", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:08:55Z", "updated_at": "2022-01-20T22:08:55Z", "author_association": "OWNER", "body": "Might want to consider SEO here too - I want people from search engines to land on `/stable/`, I wonder if I should noindex or `rel=canonical` the other documentation versions? Not sure what best practices for that is.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1608#issuecomment-1017969452", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1608", "id": 1017969452, "node_id": "IC_kwDOBm6k_c48rPss", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T22:07:55Z", "updated_at": "2022-01-20T22:07:55Z", "author_association": "OWNER", "body": "I think I want a banner at the top of the page making it obvious which version the documentation is talking about. This can be pretty low key for the current stable release, but should be visually more prominent for the `/latest/` branch and for older releases.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1109808154, "label": "Documentation should clarify /stable/ vs /latest/"}, "performed_via_github_app": null}