Skip to content

Commit

Permalink
doc: trying to get search working.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rouilj committed Feb 26, 2024
1 parent 2575715 commit 52132cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 10 additions & 2 deletions doc/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{% set script_files = ['_static/jquery.js', '_static/doctools.js',
'_static/language_data.js',
'_static/searchtools.js',
'_static/sphinx_highlight.js'] %}
{#
_templates/layout.html
~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -165,6 +169,10 @@ <h3>{{ _('Quick search') }}</h3>
<body>
<div class="header"><div class="label">Roundup</div>
{%- if pagename != "search" %}
<script id="documentation_options" data-url_root="{{ url_root }}"
src="{{ pathto('_static/documentation_options.js', 1) }}">
</script>

<div id="searchbox" style="display: none">
<form class="search" action="{{ pathto('search') }}" method="get">
<input type="text" name="q" size="18" />
Expand All @@ -182,11 +190,11 @@ <h3>{{ _('Quick search') }}</h3>
</div>
</div>
{%- block content %}
<div class="content">
<main id="main" role="main" class="content">
{{ relbar('related-top') }}
{% block body %} {% endblock %}
{{ relbar('related-bottom') }}
</div>
</main>
{%- endblock %}
{%- block footer %}
<div class="footer">
Expand Down
9 changes: 8 additions & 1 deletion website/www/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{% set script_files = ['_static/jquery.js', '_static/doctools.js',
'_static/language_data.js',
'_static/searchtools.js',
'_static/sphinx_highlight.js'] %}
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -108,7 +112,7 @@
<a title="{{ _('Index') }}" href="{{ pathto('genindex') }}">
Index</a>
</nav>
<main id="main" tabindex="-1">
<main id="main" role="main" tabindex="-1">
{% block body %} {% endblock %}
</main>
</div>
Expand Down Expand Up @@ -149,6 +153,9 @@
integrity="sha384-QGgNMMRFTi8ul5kHJ+vXysPe8gySvSA/Y3rpXZiRLzKPIw8CWY+a3ObKmQsyDr+a"
async="" src="{{ pathto('_static/goatcounter_count.v3.js', 1) }}">
</script>
<script id="documentation_options" data-url_root="{{ url_root }}"
src="{{ pathto('_static/documentation_options.js', 1) }}">
</script>
{%- if pagename != 'search' %}
{%- for scriptfile in script_files %}
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
Expand Down

0 comments on commit 52132cb

Please sign in to comment.