datalad-handbook/docs/_templates/layout.html
Adina Wagner 3906057fd9 Remove broken meta data tag that garbled html and social card rendering
Fixes #884.

The ``{{ title }}`` placeholder in ``layout.html`` exposes the
'section-number' individually in span element due to a feature request
in Sphinx since Sphinx version 2.3.1 (sphinx-doc/sphinx#6613).
This breaks a meta tag that includes the page title, spilling the title
as a random string into the body of each page, and also spilling
unrelated other HTML meta tags from the head into the body.

In practice, this leads to a rendering bug in the HTML version, and
also, as this meta tag was originally used for social card support, in
the social cards of any handbook links.

As the underlying problem won't be fixed on Sphinx side, this change
removes the problematic meta tag entirely. I'm also decreasing the
manual meta tag index that assembles the description in the social card
from the available meta tags by one, but this is more or less a blind
attempt as I don't fully understand its function or the counter (we kept
this from the project we forked to start the handbook)

The full story is also in
https://github.com/datalad-handbook/book/issues/884#issuecomment-1363731369
2022-12-23 09:29:40 +01:00

93 lines
3.2 KiB
HTML

{% extends "!layout.html" %}
{%- block extrahead %}
{# No super() because we want to avoid loading an empty custom.css file #}
{# <meta name="viewport" content="width=device-width, initial-scale=0.75, maximum-scale=0.75" /> #}
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
div.body {
min-width: initial;
max-width: initial;
}
</style>
{% if pagename == 'index' %}
<link rel="canonical" href="https://handbook.datalad.org/"/>
<meta property="og:url" content="https://handbook.datalad.org/">
{% elif pagename == '404' %}
{# No canonical on our 404 template. #}
{% else %}
<link rel="canonical" href="https://handbook.datalad.org/{{ pagename }}/"/>
<meta property="og:url" content="https://handbook.datalad.org/{{ pagename }}">
{% endif %}
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@datalad">
<meta property="twitter:image" content="https://handbook.datalad.org/_static/social-card-twitter.png">
<meta property="twitter:image:alt" content="The DataLad Handbook logo with cute little beings playing with data">
<meta property="og:image" content="https://handbook.datalad.org/_static/social-card.png">
<meta property="og:type" content="article">
{%- if metatags is defined %}
{# FIXME: For some reason the `meta` dict is always empty. Extract the desc from the `metatags` text. #}
<meta property="og:description" content="{{ metatags[15:-23] }}">
{%- endif %}
{% endblock %}
{# From: https://github.com/bitprophet/alabaster/blob/5f249677242be96601e034edb3697b7482a6abcf/alabaster/layout.html #}
{# Nav should appear before content, not after #}
{%- block content %}
{%- if theme_fixed_sidebar|lower == 'true' %}
<div class="document">
{{ sidebar() }}
{%- block document %}
<div class="documentwrapper">
{%- if render_sidebar %}
<div class="bodywrapper">
{%- endif %}
{%- block relbar_top %}
{%- if theme_show_relbar_top|tobool %}
<div class="related top">
&nbsp;
{{- rellink_markup () }}
</div>
{%- endif %}
{% endblock %}
<div class="body" role="main">
<div style="display:block;position:relative; margin-bottom: 1em;">
<div style="display:block;width:100%;padding-top:12.5%;"></div>
<div class="rpad" data-unit="8x1" style="position:absolute;left:0;top:0;right:0;bottom:0;overflow:hidden;"></div>
</div>
{% block body %} {% endblock %}
</div>
{%- block relbar_bottom %}
{%- if theme_show_relbar_bottom|tobool %}
<div class="related bottom">
&nbsp;
{{- rellink_markup () }}
</div>
{%- endif %}
{% endblock %}
{%- if render_sidebar %}
</div>
{%- endif %}
</div>
{%- endblock %}
<div class="clearer"></div>
</div>
{%- else %}
{{ super() }}
{%- endif %}
{%- endblock %}
{%- block footer %}
<div class="footer">
<div style="text-align: center;" id="waldo-tag-2171"></div>
{% if show_copyright %}<p>&copy;{{ copyright }}</p>{% endif %}
</div>
{% endblock %}