Files
liqiang b119135836
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
2026-08-20 13:12:50 +00:00

127 lines
4.9 KiB
HTML

{#-
Override: inject language switcher dropdown into the header bar,
between search and the repo source link.
-#}
{% set class = "md-header" %}
{% if "navigation.tabs.sticky" in features %}
{% set class = class ~ " md-header--shadow md-header--lifted" %}
{% elif "navigation.tabs" not in features %}
{% set class = class ~ " md-header--shadow" %}
{% endif %}
<header class="{{ class }}" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="{{ lang.t('header') }}">
<a href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}" title="{{ config.site_name | e }}" class="md-header__button md-logo" aria-label="{{ config.site_name }}" data-md-component="logo">
{% include "partials/logo.html" %}
</a>
<label class="md-header__button md-icon" for="__drawer">
{% set icon = config.theme.icon.menu or "material/menu" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</label>
{# Apply a saved collapsed state before the sidebar is parsed, preventing
it from flashing open during a full page load. #}
<script>
try {
if (window.localStorage.getItem("ai-agent-book.primary-sidebar-collapsed") === "true") {
document.documentElement.classList.add("sidebar-nav-collapsed");
}
} catch (_) {}
</script>
{# Material's drawer button above is mobile-only. On persistent-sidebar
layouts, give readers an equivalent control that does not interfere
with the mobile drawer checkbox. JavaScript reveals and wires it only
when a navigation sidebar exists. #}
<button type="button"
class="md-header__button md-icon sidebar-toggle"
data-sidebar-toggle
aria-controls="primary-navigation"
aria-expanded="true"
aria-label="隐藏侧边栏"
title="隐藏侧边栏"
hidden>
{% include ".icons/material/menu-open.svg" %}
</button>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
{{ config.site_name }}
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
{% if page.meta and page.meta.title %}
{{ page.meta.title }}
{% else %}
{{ page.title }}
{% endif %}
</span>
</div>
</div>
</div>
{% if config.theme.palette %}
{% if not config.theme.palette is mapping %}
{% include "partials/palette.html" %}
{% endif %}
{% endif %}
{% if not config.theme.palette is mapping %}
{% include "partials/javascripts/palette.html" %}
{% endif %}
{% if config.extra.alternate %}
{% include "partials/alternate.html" %}
{% endif %}
{% if "material/search" in config.plugins %}
{% set search = config.plugins["material/search"] | attr("config") %}
{% if search.enabled %}
<label class="md-header__button md-icon" for="__search">
{% set icon = config.theme.icon.search or "material/magnify" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</label>
{% include "partials/search.html" %}
{% endif %}
{% endif %}
{# ── Language selector dropdown (between search & source) ── #}
<div class="lang-switcher">
<button id="lang-selector"
class="lang-select"
type="button"
aria-haspopup="menu"
aria-expanded="false"
aria-controls="lang-menu"
aria-label="Switch language">
<span class="lang-select__icon" aria-hidden="true">
{% include ".icons/material/translate.svg" %}
</span>
<span class="lang-select__label" data-lang-label>Language</span>
<span class="lang-select__chevron" aria-hidden="true">
{% include ".icons/material/chevron-down.svg" %}
</span>
</button>
<div id="lang-menu"
class="lang-menu"
role="menu"
aria-labelledby="lang-selector"
hidden></div>
</div>
{# Expose language config + site root to the switcher script. #}
<script>window.LANG_CONFIG = {{ config.extra.languages | tojson }};</script>
<script>window.SITE_ROOT = "{{ config.site_url }}";</script>
{# Tier-3 machine-translation fallback (extras/auto-translate.js). #}
{% if config.extra.auto_translate %}
<script>window.AUTO_TRANSLATE_CONFIG = {{ config.extra.auto_translate | tojson }};</script>
{% endif %}
{% if config.repo_url %}
<div class="md-header__source">
{% include "partials/source.html" %}
</div>
{% endif %}
</nav>
{% if "navigation.tabs.sticky" in features %}
{% if "navigation.tabs" in features %}
{% include "partials/tabs.html" %}
{% endif %}
{% endif %}
</header>