From 3423a8b9c8e1e058312f5f98e66e2669ee5ce24f Mon Sep 17 00:00:00 2001
From: Adrian Price-Whelan
Date: Tue, 4 Jun 2019 14:02:56 -0400
Subject: [PATCH 1/2] assume no explicit query string means filterTutorials
---
tutorials/themes/tutorials-theme/static/searchtools.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tutorials/themes/tutorials-theme/static/searchtools.js b/tutorials/themes/tutorials-theme/static/searchtools.js
index 0cac3e472..c97ca15d0 100644
--- a/tutorials/themes/tutorials-theme/static/searchtools.js
+++ b/tutorials/themes/tutorials-theme/static/searchtools.js
@@ -337,9 +337,12 @@ var Search = {
var params = $.getQueryParameters();
if (params.q) {
var query = params.q[0];
- $('input[name="q"]')[0].value = query;
- this.performSearch(query);
+ } else {
+ // If no query string is passed, assume we want to filterTutorials
+ var query = "filterTutorials";
}
+ $('input[name="q"]')[0].value = query;
+ this.performSearch(query);
},
loadIndex : function(url) {
@@ -410,7 +413,7 @@ var Search = {
this.deferQuery(query);
//Perform search in Astropy Documentation
- if(window.location.search.search("filterTutorials")==-1){ //if filtered by tutorials, then no need to search in Astropy Documentation
+ if (query.includes("filterTutorials")) { // don't search docs if we are just looking for tutorials
var docResponse = null;
var docResult = '';
$.get('https://readthedocs.org/api/v2/docsearch/?q=' + window.location.search.split('=')[1] + '&project=astropy&version=stable&language=en', function(response){
From b3578048712fc0bb8e636845631f4c43465cf706 Mon Sep 17 00:00:00 2001
From: Adrian Price-Whelan
Date: Tue, 4 Jun 2019 14:04:00 -0400
Subject: [PATCH 2/2] link to html page without query string
---
tutorials/themes/tutorials-theme/layout.html | 17 +++++------------
tutorials/themes/tutorials-theme/navbar.html | 2 +-
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/tutorials/themes/tutorials-theme/layout.html b/tutorials/themes/tutorials-theme/layout.html
index 972a0f9c0..1acf6d24e 100644
--- a/tutorials/themes/tutorials-theme/layout.html
+++ b/tutorials/themes/tutorials-theme/layout.html
@@ -48,13 +48,6 @@
- {# this script is to redirect /tutorials.html to /tutorials.html?q=filterTutorials #}
-
@@ -82,13 +75,13 @@
{% else %}
{%- set content_card = "content-padding card" %}
{% endif %}
-
+
{% if pagename != "search" and pagename != "index" and pagename != "tutorials" and pagename != "documentation" and pagename != "examples" and pagename != "guides" %}
+
{%- set bs_content_width = "9" %}
{% endif %}
@@ -96,10 +89,10 @@ Table of contents
{% block body %}{% endblock %}
-
+
{% if pagename == "tutorials" %}
{# This is where the tutorials will be injected based on the filters #}
-
+
{% endif %}
@@ -118,7 +111,7 @@ Table of contents
{% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %}
- {% trans copyright=copyright|e %}© Copyright Astropy.{% endtrans %}
+ {% trans copyright=copyright|e %}© Copyright Astropy.{% endtrans %}
diff --git a/tutorials/themes/tutorials-theme/navbar.html b/tutorials/themes/tutorials-theme/navbar.html
index ef54276e9..e492c0d28 100644
--- a/tutorials/themes/tutorials-theme/navbar.html
+++ b/tutorials/themes/tutorials-theme/navbar.html
@@ -20,7 +20,7 @@