Skip to content

Commit

Permalink
Use algolia search in docs (run-llama#6839)
Browse files Browse the repository at this point in the history
  • Loading branch information
Disiok authored Jul 13, 2023
1 parent 595bba3 commit e11b634
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
74 changes: 74 additions & 0 deletions docs/_static/css/algolia.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* Hide search button */
.sidebar-search-container {
display: none;
}

/* Hide the search wrapper window when hitting Ctrl+K */
.search-button__wrapper.show {
display: none !important;
}

/* Make sure Algolia's search container is always on top */
.bd-article-container {
z-index: 10;
}

@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) .DocSearch-Button {
background-color: #3d4751 !important;
color: white !important;
}

body:not([data-theme="light"]) .DocSearch-Search-Icon {
color: white !important;
}

body:not([data-theme="light"]) .DocSearch-Button-Key {
color: black !important;
box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 0.01rem #3d4751 !important;
}

body:not([data-theme="light"]) .DocSearch-Commands-Key {
color: black !important;
box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 .01rem #858a8f !important;
}
}

@media (prefers-color-scheme: dark) {
body[data-theme="dark"] .DocSearch-Button {
background-color: #3d4751 !important;
color: white !important;
}

body[data-theme="dark"] .DocSearch-Search-Icon {
color: white !important;
}

body[data-theme="dark"] .DocSearch-Button-Key {
color: black !important;
box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 0.01rem #3d4751 !important;
}

body[data-theme="dark"] .DocSearch-Commands-Key {
color: black !important;
box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 .01rem #858a8f !important;
}
}

.DocSearch-Button-Key {
font-family: "SFMono-Regular", Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace !important;
padding: 0 !important;
padding-top: 0.1rem !important;
display: flex;
align-items: center;
justify-content: center;
}

.DocSearch-Commands-Key {
font-family: "SFMono-Regular", Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace !important;
padding: 0 !important;
padding-left: 0.05rem !important;
display: flex;
align-items: center;
justify-content: center;
}
9 changes: 9 additions & 0 deletions docs/_static/js/algolia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const keyboardShortcuts = [];

docsearch({
container: '#searchbox',
appId: '74VN1YECLR',
indexName: 'gpt-index',
apiKey: 'fb20bbeb2c3b7f63f89bacf797bf3a34'
});

7 changes: 7 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@

html_css_files = [
"css/custom.css",
"css/algolia.css",
"https://cdn.jsdelivr.net/npm/@docsearch/css@3",
]
html_js_files = [
"js/mendablesearch.js",
(
"https://cdn.jsdelivr.net/npm/@docsearch/[email protected]/dist/umd/index.js",
{"defer": "defer"},
),
("js/algolia.js", {"defer": "defer"}),
]

nb_execution_mode = "off"

0 comments on commit e11b634

Please sign in to comment.