Avoid hard-coding 'index' for the master document in templates (#11801)

This commit is contained in:
Shengyu Zhang 2023-12-28 15:05:14 +08:00 committed by GitHub
parent 246312287e
commit 9c3b50b31c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -3,14 +3,14 @@
{% block extrahead %} {% block extrahead %}
{{ super() }} {{ super() }}
{%- if not embedded and pagename == 'index' %} {%- if not embedded and pagename == root_doc %}
<style>.related { display: none; }</style> <style>.related { display: none; }</style>
{%- endif %} {%- endif %}
{% endblock %} {% endblock %}
{% block header %} {% block header %}
<div class="pageheader"> <div class="pageheader">
<a href="{{ pathto('index') }}"> <a href="{{ pathto(root_doc)|e }}">
<img src="{{ pathto('_static/sphinx-logo.svg', resource=True) }}" alt="logo" /> <img src="{{ pathto('_static/sphinx-logo.svg', resource=True) }}" alt="logo" />
</a> </a>
<h1>Sphinx</h1> <h1>Sphinx</h1>
@ -21,7 +21,7 @@
<div class="related" role="navigation" aria-label="related navigation"> <div class="related" role="navigation" aria-label="related navigation">
<h3>{{ _('Navigation') }}</h3> <h3>{{ _('Navigation') }}</h3>
<ul> <ul>
<li><a href="{{ pathto('index') }}">Documentation</a> &raquo;</li> <li><a href="{{ pathto(root_doc)|e }}">Documentation</a> &raquo;</li>
{%- for parent in parents %} {%- for parent in parents %}
<li class="nav-item nav-item-{{ loop.index }}"><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li> <li class="nav-item nav-item-{{ loop.index }}"><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li>
{%- endfor %} {%- endfor %}

View File

@ -35,14 +35,14 @@
<div class="header" role="banner"> <div class="header" role="banner">
{%- block haikuheader %} {%- block haikuheader %}
{%- if theme_full_logo != "false" %} {%- if theme_full_logo != "false" %}
<a href="{{ pathto('index') }}"> <a href="{{ pathto(root_doc)|e }}">
<img class="logo" src="{{ logo_url|e }}" alt="Logo"/> <img class="logo" src="{{ logo_url|e }}" alt="Logo"/>
</a> </a>
{%- else %} {%- else %}
{%- if logo -%} {%- if logo -%}
<img class="rightlogo" src="{{ logo_url|e }}" alt="Logo"/> <img class="rightlogo" src="{{ logo_url|e }}" alt="Logo"/>
{%- endif -%} {%- endif -%}
<h1 class="heading"><a href="{{ pathto('index') }}"> <h1 class="heading"><a href="{{ pathto(root_doc)|e }}">
<span>{{ shorttitle|e }}</span></a></h1> <span>{{ shorttitle|e }}</span></a></h1>
<h2 class="heading"><span>{{ title|striptags|e }}</span></h2> <h2 class="heading"><span>{{ title|striptags|e }}</span></h2>
{%- endif %} {%- endif %}

View File

@ -23,7 +23,7 @@
{% block content %} {% block content %}
<div id="content"> <div id="content">
<div class="header"> <div class="header">
<h1 class="heading"><a href="{{ pathto('index') }}" <h1 class="heading"><a href="{{ pathto(root_doc)|e }}"
title="back to the documentation overview"><span>{{ title|striptags|e }}</span></a></h1> title="back to the documentation overview"><span>{{ title|striptags|e }}</span></a></h1>
</div> </div>
<div class="relnav" role="navigation" aria-label="related navigation"> <div class="relnav" role="navigation" aria-label="related navigation">