From f92d00873c4cdc06c7142dfcbc1724c2f2f3b23c Mon Sep 17 00:00:00 2001 From: Niels Bantilan Date: Tue, 9 Jan 2024 12:00:36 -0500 Subject: [PATCH] add algolia searchbar Signed-off-by: Niels Bantilan --- docs/_static/algolia-search.js | 12 ++++ docs/_static/algolia.css | 23 ++++++ docs/_templates/base.html | 126 +++++++++++++++++++++++++++++++++ docs/_templates/search.html | 5 ++ docs/conf.py | 3 +- 5 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 docs/_static/algolia-search.js create mode 100644 docs/_static/algolia.css create mode 100644 docs/_templates/base.html create mode 100644 docs/_templates/search.html diff --git a/docs/_static/algolia-search.js b/docs/_static/algolia-search.js new file mode 100644 index 0000000000..34789e97e8 --- /dev/null +++ b/docs/_static/algolia-search.js @@ -0,0 +1,12 @@ +/*global docsearch*/ + +docsearch({ + container: ".docsearch", + appId: "WLG0MZB58Q", + apiKey: "28bf9bfd4a77a7d6b3ab7e98c671e781", + indexName: "flyte", + searchParameters: { + hitsPerPage: 10, + // See https://www.algolia.com/doc/api-reference/api-parameters/ + }, +}); diff --git a/docs/_static/algolia.css b/docs/_static/algolia.css new file mode 100644 index 0000000000..c051ed6197 --- /dev/null +++ b/docs/_static/algolia.css @@ -0,0 +1,23 @@ +/* Algolia Docs Search Style */ +.docsearch { + width: 100% !important; +} + +.DocSearch-Button { + height: 60px !important; + width: 100% !important; + margin: 0px !important; + border-radius: 0 !important; + border-bottom: 1px solid var(--color-header-border) !important; + background: var(--color-sidebar-background) !important; + padding: 0 15px !important; +} + +.DocSearch-Button:hover, .DocSearch-Button:active { + box-shadow: none !important; + background: var(--docsearch-searchbox-background) !important; +} + +.sidebar-search-container::before { + content: none; +} diff --git a/docs/_templates/base.html b/docs/_templates/base.html new file mode 100644 index 0000000000..867023a4ce --- /dev/null +++ b/docs/_templates/base.html @@ -0,0 +1,126 @@ + + + + {%- 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 theme_styles -%} + + {%- block extra_styles -%} + + + {%- endblock extra_styles -%} + + {%- 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/_templates/search.html b/docs/_templates/search.html new file mode 100644 index 0000000000..a6bfc08dd9 --- /dev/null +++ b/docs/_templates/search.html @@ -0,0 +1,5 @@ + diff --git a/docs/conf.py b/docs/conf.py index f1ac1cb684..60b5bb1232 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -186,7 +186,8 @@ # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] -html_css_files = ["custom.css", "flyte.css"] +html_css_files = ["custom.css", "flyte.css", "algolia.css"] +html_js_files = ["algolia-search.js"] # Custom sidebar templates, must be a dictionary that maps document names # to template names.