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 %}
{{ super() }}
{%- if not embedded and pagename == 'index' %}
{%- if not embedded and pagename == root_doc %}
<style>.related { display: none; }</style>
{%- endif %}
{% endblock %}
{% block header %}
<div class="pageheader">
<a href="{{ pathto('index') }}">
<a href="{{ pathto(root_doc)|e }}">
<img src="{{ pathto('_static/sphinx-logo.svg', resource=True) }}" alt="logo" />
</a>
<h1>Sphinx</h1>
@ -21,7 +21,7 @@
<div class="related" role="navigation" aria-label="related navigation">
<h3>{{ _('Navigation') }}</h3>
<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 %}
<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 %}

View File

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

View File

@ -23,7 +23,7 @@
{% block content %}
<div id="content">
<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>
</div>
<div class="relnav" role="navigation" aria-label="related navigation">