From e441f196c1f6db9445e5259c55c2d93ac6edcd2d Mon Sep 17 00:00:00 2001 From: Niklas Q Nielsen Date: Wed, 24 Aug 2022 15:29:42 -0700 Subject: [PATCH 01/10] Algolia doc search prototype --- docs/source/_templates/base.html | 115 +++++++++++++++++++++ docs/source/_templates/sidebar/search.html | 1 + docs/source/conf.py | 4 +- 3 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 docs/source/_templates/base.html create mode 100644 docs/source/_templates/sidebar/search.html diff --git a/docs/source/_templates/base.html b/docs/source/_templates/base.html new file mode 100644 index 0000000000..b65665308e --- /dev/null +++ b/docs/source/_templates/base.html @@ -0,0 +1,115 @@ + + + + {%- block site_meta -%} + + + + + {%- if metatags %}{{ metatags }}{% endif -%} + + {%- block linktags %} + {%- if hasdoc('about') -%} + + {%- endif -%} + {%- if hasdoc('genindex') -%} + + {%- endif -%} + {%- if hasdoc('search') -%} + + {%- endif -%} + {%- if hasdoc('copyright') -%} + + {%- endif -%} + {%- if next -%} + + {%- endif -%} + {%- if prev -%} + + {%- endif -%} + {#- rel="canonical" (set by html_baseurl) -#} + {%- if pageurl %} + + {%- endif %} + {%- endblock linktags %} + + {# Favicon #} + {%- if favicon_url -%} + + {%- endif -%} + + {#- Generator banner -#} + + + {%- endblock site_meta -%} + + {#- Site title -#} + {%- block htmltitle -%} + {% if not docstitle %} + {{ title|striptags|e }} + {% elif pagename == master_doc %} + {{ docstitle|striptags|e }} + {% else %} + {{ title|striptags|e }} - {{ docstitle|striptags|e }} + {% endif %} + {%- endblock -%} + + {%- block styles -%} + + {# Custom stylesheets #} + {%- block regular_styles -%} + {%- for css in css_files -%} + {% if css|attr("filename") -%} + {{ css_tag(css) }} + {%- else -%} + + {%- endif %} + {% endfor -%} + {%- endblock regular_styles -%} + + {#- Theme-related stylesheets -#} + {%- block theme_styles %} + {% include "partials/_head_css_variables.html" with context %} + {%- endblock -%} + + {%- block extra_styles %} + {%- endblock -%} + + {%- endblock styles -%} + + {#- Custom front matter #} + {%- block extrahead -%}{%- endblock -%} + + + {% block body %} + + {% endblock %} + + {%- block scripts -%} + + + + {# Custom JS #} + {%- block regular_scripts -%} + {% for path in script_files -%} + {{ js_tag(path) }} + {% endfor -%} + {%- endblock regular_scripts -%} + + {# Theme-related JavaScript code #} + {%- block theme_scripts -%} + {%- endblock -%} + + {%- endblock scripts -%} + + diff --git a/docs/source/_templates/sidebar/search.html b/docs/source/_templates/sidebar/search.html new file mode 100644 index 0000000000..19e720e705 --- /dev/null +++ b/docs/source/_templates/sidebar/search.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 1f1c05099e..e3d5520a61 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -163,9 +163,9 @@ def _get_commit_sha() -> str: html_title = ' Composer' # Customize CSS -html_css_files = ['css/custom.css'] +html_css_files = ['css/custom.css', 'https://cdn.jsdelivr.net/npm/@docsearch/css@3'] html_js_files = [ - 'js/posthog.js', + 'js/posthog.js' ] # Mosaic logo From 6025244b8a767b286693e98555794806f2526883 Mon Sep 17 00:00:00 2001 From: Niklas Q Nielsen Date: Wed, 24 Aug 2022 22:31:31 -0700 Subject: [PATCH 02/10] Spacing --- docs/source/_templates/sidebar/search.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/_templates/sidebar/search.html b/docs/source/_templates/sidebar/search.html index 19e720e705..531af2e865 100644 --- a/docs/source/_templates/sidebar/search.html +++ b/docs/source/_templates/sidebar/search.html @@ -1 +1,3 @@ -
\ No newline at end of file +
+
+
\ No newline at end of file From 6df902be3396d3715c89c83797dab13220676d96 Mon Sep 17 00:00:00 2001 From: Niklas Q Nielsen Date: Thu, 25 Aug 2022 14:42:35 -0700 Subject: [PATCH 03/10] Display documentation item version in search results --- docs/source/_templates/base.html | 254 +++++++++++++++++-------------- 1 file changed, 140 insertions(+), 114 deletions(-) diff --git a/docs/source/_templates/base.html b/docs/source/_templates/base.html index b65665308e..39811f474e 100644 --- a/docs/source/_templates/base.html +++ b/docs/source/_templates/base.html @@ -1,115 +1,141 @@ - - - {%- block site_meta -%} - - - - - {%- if metatags %}{{ metatags }}{% endif -%} - - {%- block linktags %} - {%- if hasdoc('about') -%} - - {%- endif -%} - {%- if hasdoc('genindex') -%} - - {%- endif -%} - {%- if hasdoc('search') -%} - - {%- endif -%} - {%- if hasdoc('copyright') -%} - - {%- endif -%} - {%- if next -%} - - {%- endif -%} - {%- if prev -%} - - {%- endif -%} - {#- rel="canonical" (set by html_baseurl) -#} - {%- if pageurl %} - - {%- endif %} - {%- endblock linktags %} - - {# Favicon #} - {%- if favicon_url -%} - - {%- endif -%} - - {#- Generator banner -#} - - - {%- endblock site_meta -%} - - {#- Site title -#} - {%- block htmltitle -%} - {% if not docstitle %} - {{ title|striptags|e }} - {% elif pagename == master_doc %} - {{ docstitle|striptags|e }} - {% else %} - {{ title|striptags|e }} - {{ docstitle|striptags|e }} - {% endif %} - {%- endblock -%} - - {%- block styles -%} - - {# Custom stylesheets #} - {%- block regular_styles -%} - {%- for css in css_files -%} - {% if css|attr("filename") -%} - {{ css_tag(css) }} - {%- else -%} - - {%- endif %} - {% endfor -%} - {%- endblock regular_styles -%} - - {#- Theme-related stylesheets -#} - {%- block theme_styles %} - {% include "partials/_head_css_variables.html" with context %} - {%- endblock -%} - - {%- block extra_styles %} - {%- endblock -%} - - {%- endblock styles -%} - - {#- Custom front matter #} - {%- block extrahead -%}{%- endblock -%} - - - {% block body %} - - {% endblock %} - - {%- block scripts -%} - - - - {# Custom JS #} - {%- block regular_scripts -%} - {% for path in script_files -%} - {{ js_tag(path) }} - {% endfor -%} - {%- endblock regular_scripts -%} - - {# Theme-related JavaScript code #} - {%- block theme_scripts -%} - {%- endblock -%} - - {%- endblock scripts -%} - - + + + + {%- block site_meta -%} + + + + + {%- if metatags %}{{ metatags }}{% endif -%} + + {%- block linktags %} + {%- if hasdoc('about') -%} + + {%- endif -%} + {%- if hasdoc('genindex') -%} + + {%- endif -%} + {%- if hasdoc('search') -%} + + {%- endif -%} + {%- if hasdoc('copyright') -%} + + {%- endif -%} + {%- if next -%} + + {%- endif -%} + {%- if prev -%} + + {%- endif -%} + {#- rel="canonical" (set by html_baseurl) -#} + {%- if pageurl %} + + {%- endif %} + {%- endblock linktags %} + + {# Favicon #} + {%- if favicon_url -%} + + {%- endif -%} + + {#- Generator banner -#} + + + {%- endblock site_meta -%} + + {#- Site title -#} + {%- block htmltitle -%} + {% if not docstitle %} + {{ title|striptags|e }} + {% elif pagename == master_doc %} + {{ docstitle|striptags|e }} + {% else %} + {{ title|striptags|e }} - {{ docstitle|striptags|e }} + {% endif %} + {%- endblock -%} + + {%- block styles -%} + + {# Custom stylesheets #} + {%- block regular_styles -%} + {%- for css in css_files -%} + {% if css|attr("filename") -%} + {{ css_tag(css) }} + {%- else -%} + + {%- endif %} + {% endfor -%} + {%- endblock regular_styles -%} + + {#- Theme-related stylesheets -#} + {%- block theme_styles %} + {% include "partials/_head_css_variables.html" with context %} + {%- endblock -%} + + {%- block extra_styles %} + {%- endblock -%} + + {%- endblock styles -%} + + {#- Custom front matter #} + {%- block extrahead -%}{%- endblock -%} + + + + {% block body %} + + {% endblock %} + + {%- block scripts -%} + + + + {# Custom JS #} + {%- block regular_scripts -%} + {% for path in script_files -%} + {{ js_tag(path) }} + {% endfor -%} + {%- endblock regular_scripts -%} + + {# Theme-related JavaScript code #} + {%- block theme_scripts -%} + {%- endblock -%} + + {%- endblock scripts -%} + + + \ No newline at end of file From f4f8c6a6259d6a2cb43daff0ed4d89e4c1e82551 Mon Sep 17 00:00:00 2001 From: Niklas Q Nielsen Date: Thu, 25 Aug 2022 14:45:35 -0700 Subject: [PATCH 04/10] Removed empty line --- docs/source/_templates/base.html | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/_templates/base.html b/docs/source/_templates/base.html index 39811f474e..71baaf7549 100644 --- a/docs/source/_templates/base.html +++ b/docs/source/_templates/base.html @@ -134,7 +134,6 @@ {# Theme-related JavaScript code #} {%- block theme_scripts -%} {%- endblock -%} - {%- endblock scripts -%} From be76bc527ae97952f35049e6dd0374373a892b20 Mon Sep 17 00:00:00 2001 From: Niklas Q Nielsen Date: Thu, 25 Aug 2022 22:04:44 -0700 Subject: [PATCH 05/10] Server side version filtering --- docs/source/_templates/base.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/source/_templates/base.html b/docs/source/_templates/base.html index 71baaf7549..51b70be09f 100644 --- a/docs/source/_templates/base.html +++ b/docs/source/_templates/base.html @@ -93,7 +93,7 @@