[docs] add deprecation notice banner to legacy documentation site (#23516)

This commit is contained in:
zijiexia
2026-04-22 20:17:53 -07:00
committed by GitHub
parent 214c35b031
commit 6490afe36e
4 changed files with 84 additions and 1 deletions
+49
View File
@@ -0,0 +1,49 @@
(function () {
"use strict";
var oldOrigin = "https://sgl-project.github.io";
var newOrigin = "https://docs.sglang.io";
function buildNewDocsUrl() {
var href = window.location.href;
if (href === oldOrigin || href.indexOf(oldOrigin + "/") === 0) {
return href.replace(oldOrigin, newOrigin);
}
return newOrigin + window.location.pathname + window.location.search + window.location.hash;
}
function addDeprecationBanner() {
if (document.getElementById("sglang-docs-deprecation-banner")) {
return;
}
var link = document.createElement("a");
link.href = buildNewDocsUrl();
link.textContent = link.href;
var banner = document.createElement("div");
banner.id = "sglang-docs-deprecation-banner";
banner.className = "sglang-docs-deprecation-banner";
banner.setAttribute("role", "status");
banner.setAttribute("aria-live", "polite");
var prefix = document.createTextNode(
"This legacy documentation site will be deprecated soon. Please use the new SGLang documentation at "
);
var suffix = document.createTextNode(".");
banner.appendChild(prefix);
banner.appendChild(link);
banner.appendChild(suffix);
document.body.insertBefore(banner, document.body.firstChild);
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", addDeprecationBanner);
} else {
addDeprecationBanner();
}
})();