Skip to content

Commit 52132cb

Browse files
committed
doc: trying to get search working.
Searching for www works beter now: * no more javscript errors in console * search context blocks are displayed Had to add role="main" as that is used by the javascript to id the body of the page to extract text snippets. Had to set script_files to load all the needed javascript in order. Had to set data-url_root on a id'ed tag for javacript to work. On doc/_templates/layout.html replaced div with main tag and set id and duplicate role="main" for use by js querySelector.
1 parent 2575715 commit 52132cb

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

doc/_templates/layout.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
{% set script_files = ['_static/jquery.js', '_static/doctools.js',
2+
'_static/language_data.js',
3+
'_static/searchtools.js',
4+
'_static/sphinx_highlight.js'] %}
15
{#
26
_templates/layout.html
37
~~~~~~~~~~~~~~~~~~~~~~
@@ -165,6 +169,10 @@ <h3>{{ _('Quick search') }}</h3>
165169
<body>
166170
<div class="header"><div class="label">Roundup</div>
167171
{%- if pagename != "search" %}
172+
<script id="documentation_options" data-url_root="{{ url_root }}"
173+
src="{{ pathto('_static/documentation_options.js', 1) }}">
174+
</script>
175+
168176
<div id="searchbox" style="display: none">
169177
<form class="search" action="{{ pathto('search') }}" method="get">
170178
<input type="text" name="q" size="18" />
@@ -182,11 +190,11 @@ <h3>{{ _('Quick search') }}</h3>
182190
</div>
183191
</div>
184192
{%- block content %}
185-
<div class="content">
193+
<main id="main" role="main" class="content">
186194
{{ relbar('related-top') }}
187195
{% block body %} {% endblock %}
188196
{{ relbar('related-bottom') }}
189-
</div>
197+
</main>
190198
{%- endblock %}
191199
{%- block footer %}
192200
<div class="footer">

website/www/_templates/layout.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
{% set script_files = ['_static/jquery.js', '_static/doctools.js',
2+
'_static/language_data.js',
3+
'_static/searchtools.js',
4+
'_static/sphinx_highlight.js'] %}
15
<!DOCTYPE html>
26
<html lang="en">
37
<head>
@@ -108,7 +112,7 @@
108112
<a title="{{ _('Index') }}" href="{{ pathto('genindex') }}">
109113
Index</a>
110114
</nav>
111-
<main id="main" tabindex="-1">
115+
<main id="main" role="main" tabindex="-1">
112116
{% block body %} {% endblock %}
113117
</main>
114118
</div>
@@ -149,6 +153,9 @@
149153
integrity="sha384-QGgNMMRFTi8ul5kHJ+vXysPe8gySvSA/Y3rpXZiRLzKPIw8CWY+a3ObKmQsyDr+a"
150154
async="" src="{{ pathto('_static/goatcounter_count.v3.js', 1) }}">
151155
</script>
156+
<script id="documentation_options" data-url_root="{{ url_root }}"
157+
src="{{ pathto('_static/documentation_options.js', 1) }}">
158+
</script>
152159
{%- if pagename != 'search' %}
153160
{%- for scriptfile in script_files %}
154161
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>

0 commit comments

Comments
 (0)