{% extends "base.html" %}

{% block extrahead %}
<meta name="theme-color" content="#1a7dc9" />
{% endblock %}

{% block announce %}
{% if page and page.meta.version_warning %}
<div class="versionwarning" style="margin: .6rem auto; padding: 0 .8rem">
  <h1>⚠ You are viewing an archived snapshot of the documentation for Knative version: {{ page.meta.knative_version }}</h1>
  <p>
  Knative {{ page.meta.knative_version }} documentation is no longer actively maintained. The documentation you are currently viewing is a static snapshot. For up-to-date documentation, see <a href="{{ base_url }}/../docs/">the latest version</a>.
  </p>
</div>
{% endif %}
{% endblock %}

{# TEMPORARY HACK: replace {{ super() }} with the asset link, to use custom JSON build. #}
{% block scripts %}
  <script src="{{ 'assets/javascripts/bundle.0af37618.min.js' | url }}"></script>
  <!-- For now, load Jquery and Bootstrap because the cookie warning (built from the hugo-based website) uses them -->
  <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
  <script src="/js/cookie-consent.js"></script>
{% endblock %}

  {# This overrides config.base in javascript to help it find the versions correctly. #}
{% block config %}
  {% set _ = namespace() %}

  <!-- Extra configuration -->
  {% set _.tags = config.extra.tags %}

  <!-- Versioning -->
  {# This is changed from upstream to only show version picker on versioned pages #}
  {%- if config.extra.version -%}
    {%- if config.extra.version.provider == "mike" -%}
    {%- set mike = config.plugins.mike -%}
      {%- if not mike or mike.config.version_selector -%}
        {%- set _.version = config.extra.version -%}
      {%- endif -%}
    {%- elif config.extra.version.provider == "directory" -%}
      {%- if page and (page.meta.version) -%}
        {%- set _.version = {"provider":"directory", "declared_version": page.meta.version | string} -%}
      {%- endif -%}
    {%- endif -%}
  {%- endif -%}

  <!-- Configuration -->
  <script id="__config" type="application/json">
    {{- {
      "base": base_url,
      "features": features,
      "translations": {
        "clipboard.copy": lang.t("clipboard.copy"),
        "clipboard.copied": lang.t("clipboard.copied"),
        "search.result.placeholder": lang.t("search.result.placeholder"),
        "search.result.none": lang.t("search.result.none"),
        "search.result.one": lang.t("search.result.one"),
        "search.result.other": lang.t("search.result.other"),
        "search.result.more.one": lang.t("search.result.more.one"),
        "search.result.more.other": lang.t("search.result.more.other"),
        "search.result.term.missing": lang.t("search.result.term.missing"),
        "select.version": lang.t("select.version")
      },
      "search": "assets/javascripts/workers/search.973d3a69.min.js" | url,
      "tags": _.tags or none,
      "version": _.version or none
    } | tojson -}}
  </script>
{% endblock %}
