From 21d56c8b1a1b89ed0041bb0115ec76fae68f168f Mon Sep 17 00:00:00 2001 From: object-Object Date: Sat, 2 Sep 2023 13:34:58 -0400 Subject: [PATCH] the past is a foreign country --- doc/src/hexdoc/_templates/main.js.jinja | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/src/hexdoc/_templates/main.js.jinja b/doc/src/hexdoc/_templates/main.js.jinja index b4d01519..ee7d334a 100644 --- a/doc/src/hexdoc/_templates/main.js.jinja +++ b/doc/src/hexdoc/_templates/main.js.jinja @@ -370,6 +370,19 @@ function sortSitemapVersions(sitemap) { function addDropdowns(sitemap) { let [branches, versions] = sortSitemapVersions(sitemap); + // set the "old version" message if this page is a version number, but not the latest one + // this isn't a dropdown, but it's here since we have the data anyway + if (versions.slice(1).includes(VERSION)) { + // thanks for the idea petra + let oldVersionNotice = document.createElement("i"); + oldVersionNotice.textContent = "The past is a foreign country; they do things differently there."; + + document.getElementById("old-version-notice").append( + document.createElement("br"), + oldVersionNotice, + ); + } + // versions document.getElementById("version-dropdown").append( ...versionDropdownItems(sitemap, branches),