fastmcp/docs/v3-banner.js
Jeremiah Lowin c556f07a66
Archive v3 docs and publish v4 as the primary version (#4613)
* Archive v3 docs under /v3 and publish v4 as the primary version

* Label primary docs version v4.0.0 (alpha 1)

* Add What's New in v4 page; fix upgrade-guide phrasing; point banner at What's New

* Rewrite What's New around v4's new capabilities, not the sampling deprecation

* Lead What's New with the SDK v2 engine swap and the SEPs it brings

* State ships now (link Session State); tasks arrive next alpha

* Exclude docs/v3 frozen snapshots from doc-example import validation
2026-07-23 19:47:57 -04:00

39 lines
1.2 KiB
JavaScript

// Add v3 banner inside content-container with negative margins
(function() {
if (typeof window === 'undefined') return;
function addBanner() {
const isV3 = window.location.pathname.includes('/v3/');
const container = document.getElementById('content-container');
let banner = document.getElementById('v3-banner');
if (isV3 && container) {
if (!banner) {
banner = document.createElement('div');
banner.id = 'v3-banner';
banner.innerHTML = 'These are the docs for FastMCP 3. <a href="/getting-started/welcome" style="color: white; text-decoration: underline; font-weight: 700;">FastMCP 4</a> is now available.';
container.insertBefore(banner, container.firstChild);
}
} else if (!isV3 && banner) {
banner.remove();
}
}
function run() {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', addBanner);
} else {
addBanner();
}
}
run();
let lastUrl = location.href;
new MutationObserver(() => {
if (location.href !== lastUrl) {
lastUrl = location.href;
setTimeout(addBanner, 100);
}
}).observe(document.body, {subtree: true, childList: true});
})();