mkdocs/overrides/main.html
Rama master · réplica de lectura del repositorio original.
{% extends "base.html" %}
{% block extrahead %}
{#- The single mapping from the shared dark/light choice (localStorage['dstack-theme'], shared with
website/src/theme.ts) onto Material's native palette. Defined as a global here — in the first
inline script, during parse — so every other theme touchpoint (the header radio sync, the footer
toggle in extra.js, the cross-tab storage listener below) reuses ONE definition instead of
re-spelling the {index, color} object and the dark=slate=index-1 mapping. Uses Material's
__md_set (defined just above in partials/javascripts/base.html) so the key gets Material's scope
prefix (e.g. /.__palette) — a plain localStorage key is ignored by Material. -#}
<script>
// dark → slate (palette index 1); light → default (index 0). setScheme also flips the live
// <body> attribute (for runtime toggles); omit it at first paint (Material's inline palette
// script applies the scheme from __palette during parse — flash-free).
window.__dstackApplyTheme = function (dark, setScheme) {
try {
if (typeof __md_set === 'function') {
__md_set('__palette', { index: dark ? 1 : 0, color: { media: '', scheme: dark ? 'slate' : 'default', primary: 'white', accent: 'lilac' } });
}
var radio = document.getElementById('__palette_' + (dark ? 1 : 0));
if (radio) radio.checked = true;
if (setScheme) document.body.setAttribute('data-md-color-scheme', dark ? 'slate' : 'default');
} catch (e) {}
};
try { window.__dstackApplyTheme(localStorage.getItem('dstack-theme') === 'dark', false); } catch (e) {}
</script>
<link rel="preload" href="{{ 'assets/fonts/Geist-Variable.woff2' | url }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ 'assets/fonts/GeistMono-Variable.woff2' | url }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ 'assets/fonts/GeistPixel-Square.woff2' | url }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ 'assets/fonts/GeistPixel-Circle.woff2' | url }}" as="font" type="font/woff2" crossorigin>
{#
Structured data (JSON-LD) for SEO.
- Homepage gets WebSite + Organization schema (helps Google show sitelinks and knowledge panel).
- All other pages get BreadcrumbList schema (helps Google show breadcrumb trails in results).
Breadcrumb URLs are resolved via _find_leaf_url because MkDocs nav sections don't have
their own URLs — we use the first descendant page's URL as a proxy.
Dedup by title to collapse nav levels duplicated by plugins (e.g. the blog plugin nests
"Blog" inside "Blog"). The current page is omitted when its title matches the last
ancestor (e.g. /examples/ is both the "Examples" section index and the page itself).
#}
{% macro _find_leaf_url(nav_item) -%}
{%- if nav_item.url -%}
/{{ nav_item.url }}
{%- elif nav_item.children -%}
{{ _find_leaf_url(nav_item.children | first) }}
{%- endif -%}
{%- endmacro %}
{% if page.is_homepage %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "WebSite",
"name": "dstack",
"url": "https://dstack.ai/"
},
{
"@type": "Organization",
"name": "dstack",
"url": "https://dstack.ai/",
"logo": "https://dstack.ai/assets/images/dstack-logo-notext.svg",
"sameAs": [
"https://github.com/dstackai/dstack",
"https://discord.gg/u8SmfwPpMd",
"https://x.com/dstackai",
"https://www.linkedin.com/company/dstackai"
]
}
]
}
</script>
{% elif page.ancestors | length > 0 %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://dstack.ai/"
}
{%- set pos = namespace(val=2) -%}
{%- set prev = namespace(title="") -%}
{%- for ancestor in page.ancestors | reverse -%}
{%- if ancestor.title != prev.title -%}
,{
"@type": "ListItem",
"position": {{ pos.val }},
"name": "{{ ancestor.title | e }}",
"item": "https://dstack.ai{{ _find_leaf_url(ancestor) | trim }}"
}
{%- set pos.val = pos.val + 1 -%}
{%- endif -%}
{%- set prev.title = ancestor.title -%}
{%- endfor -%}
{%- if page.title != prev.title -%}
,{
"@type": "ListItem",
"position": {{ pos.val }},
"name": "{{ page.title | e }}"
}
{%- endif -%}
]
}
</script>
{% endif %}
{% endblock %}
{% block container %}
<div class="md-content" data-md-component="content">
{% if "navigation.path" in features %}
{% include "path.html" %}
{% endif %}
<article class="md-content__inner md-typeset">
{% block content %}
{% include "partials/content.html" %}
{% if page.previous_page or page.next_page %}
{% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "footer" in page.meta.hide %}
{% endif %}
<nav class="md-footer__inner md-grid" aria-label="{{ lang.t('footer') }}" {{ hidden }}>
{% if page.previous_page %}
{% set direction = lang.t("footer.previous") %}
<a href="{{ page.previous_page.url | url }}" class="md-footer__link md-footer__link--prev" aria-label="{{ direction }}: {{ page.previous_page.title | e }}">
<div class="md-footer__button md-icon">
{% set icon = config.theme.icon.previous or "material/arrow-left" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</div>
<div class="md-footer__title">
<span class="md-footer__direction">
{{ direction }}
</span>
<div class="md-ellipsis">
{{ page.previous_page.title }}
</div>
</div>
</a>
{% endif %}
{% if page.next_page %}
{% set direction = lang.t("footer.next") %}
<a href="{{ page.next_page.url | url }}" class="md-footer__link md-footer__link--next" aria-label="{{ direction }}: {{ page.next_page.title | e }}">
<div class="md-footer__title">
<span class="md-footer__direction">
{{ direction }}
</span>
<div class="md-ellipsis">
{{ page.next_page.title }}
</div>
</div>
<div class="md-footer__button md-icon">
{% set icon = config.theme.icon.next or "material/arrow-right" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</div>
</a>
{% endif %}
</nav>
{% endif %}
{% endblock %}
</article>
{% include "partials/tx-footer.html" %}
</div>
{% endblock %}
{% block header %}
{% include "header-2.html" %}
{% endblock %}
{# Tabs are rendered inside the header (header-2.html); suppress base.html's below-header
tabs so they aren't duplicated. #}
{% block tabs %}{% endblock %}
{% block scripts %}
<script src="/assets/javascripts/termynal.js"></script>
<script async src="https://tally.so/widgets/embed.js"></script>
{{ super() }}
{#- Live cross-tab/cross-app sync: when the shared dstack-theme changes elsewhere (e.g. the React
landing's footer toggle in another tab), apply it here without a reload. The docs' own footer
toggle writes dstack-theme directly (assets/javascripts/extra.js). First paint is flash-free via
extrahead → __palette → Material's inline palette script. -#}
<script>
window.addEventListener('storage', function (e) {
if (e.key === 'dstack-theme') window.__dstackApplyTheme(e.newValue === 'dark', true);
});
</script>
<script src="https://widget.kapa.ai/kapa-widget.bundle.js"
data-website-id="1c028b8e-609e-40e3-b792-f3939a461850"
data-project-name="dstack"
data-project-color="rgba(0, 0, 0, 0.87)"
data-font-size-sm="16px"
data-font-size-md="0.5rem"
data-font-size-lg="0.75rem"
data-modal-disclaimer-font-size="0.75rem"
data-deep-thinking-button-font-size="0.7rem"
data-button-width="3.6rem"
data-button-height="3.6rem"
data-button-text-font-weight="400"
data-button-image-width="18"
data-button-image-height="18"
data-modal-image="/assets/images/dstack-logo-notext.svg"
data-modal-title="AI Assistant"
data-button-text-shadow="none"
data-button-box-shadow="none"
data-font-family='metro-web, Metro, -apple-system, "system-ui", "Segoe UI", Roboto'
data-button-text-font-family='metro-web, Metro, -apple-system, "system-ui", "Segoe UI", Roboto'
data-project-logo="/assets/images/kapa.svg"
data-modal-disclaimer="This is an assistant with access to documentation, examples, and GitHub issues."
data-modal-example-questions="How do I install the dstack CLI?,How do I set up the dstack server?"
data-user-analytics-fingerprint-enabled="true"
data-modal-x-offset="0"
data-modal-y-offset="0"
data-modal-with-overlay="false"
data-modal-inner-flex-direction="column"
data-modal-inner-justify-content="end"
data-modal-inner-max-width="600px"
data-modal-inner-position-left="auto"
data-modal-inner-position-right="0"
data-modal-inner-position-bottom="0"
data-modal-inner-position-top="0"
data-modal-lock-scroll="false"
data-modal-header-bg-color="#fff"
data-modal-border-radius="3px"
data-scale-factor="0.9"
async></script>
{% endblock %}
{% block announce %}
<a href="/blog/glm53-gb200-nvl72-coding-agents/">Serve GLM-5.3 Coding Agents Faster and Cheaper on GB200 NVL72<span class="icon"><svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12h15"/><path d="m12.5 5.5 6.5 6.5-6.5 6.5"/></svg></span></a>
{% endblock %}
{# Footer is rendered INSIDE .md-content (above, after the article) — NOT as a full-width sibling —
so it starts to the RIGHT of the left sidebar (left sidebar stays a full-height column on its
left) and keeps .md-main__inner tall enough that the sticky left sidebar never eases away. #}
{% block footer %}{% endblock %}
{% block site_nav %}
{% if nav %}
{% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "navigation" in page.meta.hide %}
{% endif %}
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" {{ hidden }}>
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
{# Inside the scroll content so it scrolls out with the nav, like /old (not pinned). #}
<button type="button" class="cs-nav-collapse" data-cs-nav-toggle aria-label="Collapse navigation">
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M11 2 5 8l6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
{% include "partials/nav.html" %}
</div>
</div>
</div>
{% endif %}
{% if "toc.integrate" not in features %}
{% if page.meta and page.meta.hide %}
{% set hidden = "hidden" if "toc" in page.meta.hide %}
{% endif %}
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" {{ hidden }}>
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
{% include "toc.html" %}
</div>
</div>
</div>
{% endif %}
{% endblock %}