Skip to content

Commit 205edb5

Browse files
Test Algolia Search
new file: docs/js/algolia.js modified: mkdocs.yml modified: overrides/main.html
1 parent 03a1826 commit 205edb5

File tree

6 files changed

+89
-14
lines changed

6 files changed

+89
-14
lines changed

docs/css/algolia.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Style the Algolia DocSearch input */
2+
.algolia-docsearch-container {
3+
padding-left: 1rem;
4+
padding-right: 1rem;
5+
display: flex;
6+
align-items: center;
7+
}
8+
9+
#docsearch {
10+
width: 250px;
11+
min-width: 150px;
12+
}

docs/css/extra.css

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,61 @@
4545
/* Select only elements inside the What's new section */
4646
nav[data-md-level="1"][aria-labelledby="__nav_2_label"] .md-ellipsis {
4747
text-indent: 0.8rem;
48-
}
48+
}
49+
50+
/* Algolia Search Configs */
51+
52+
/* Increase font size for the search input */
53+
.DocSearch-Input {
54+
font-size: 1rem !important; /* adjust size as needed */
55+
}
56+
57+
/* Increase font size for the result title */
58+
.DocSearch-Hit-title {
59+
font-size: 0.7rem !important;
60+
}
61+
62+
/* Increase font size for the result content/snippet */
63+
.DocSearch-Hit-path,
64+
.DocSearch-Hit-text {
65+
font-size: 0.8rem !important;
66+
}
67+
68+
/* Optionally increase font size for breadcrumbs or metadata */
69+
.DocSearch-Hit-Tree,
70+
.DocSearch-Hit-action {
71+
font-size: 0.75rem !important;
72+
}
73+
74+
/* 🧭 Section headings like "Documentation", "Recent Searches" */
75+
.DocSearch-Dropdown-Container .DocSearch-Title {
76+
font-size: 1.1rem !important;
77+
font-weight: 600;
78+
}
79+
80+
/* ❌ "No recent searches" or empty state text */
81+
.DocSearch-Help {
82+
font-size: 1rem !important;
83+
}
84+
85+
/* ⌨️ Shortcut hints like "Press / to search" */
86+
.DocSearch-StartScreen .DocSearch-Help,
87+
.DocSearch-StartScreen .DocSearch-Label {
88+
font-size: 1rem !important;
89+
}
90+
91+
/* 🔣 Placeholder and input */
92+
.DocSearch-Input {
93+
font-size: 1.2rem !important;
94+
}
95+
96+
/* 🔠 Keyboard shortcuts */
97+
.DocSearch-Button-Keys {
98+
font-size: 1rem !important;
99+
}
100+
101+
/* Optional: make the overall modal content bigger */
102+
.DocSearch-Container {
103+
font-size: 1rem !important;
104+
}
105+

docs/js/init-algolia.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
docsearch({
2+
container: '#docsearch',
3+
appId: 'QDKRBCAI99',
4+
indexName: 'Percona documentation',
5+
apiKey: 'a5222c0ed6e9e6c67a77cfd2e26000e1',
6+
});

mkdocs.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ theme:
2828
toggle:
2929
icon: material/brightness-4
3030
name: Color theme set to Dark Mode. Click to change
31+
3132
features:
3233
- navigation.indexes
3334
- navigation.instant
@@ -44,9 +45,13 @@ extra_css:
4445
- css/landing.css
4546
- css/osano.css
4647
- css/extra.css
48+
- css/algolia.css
49+
- https://cdn.jsdelivr.net/npm/@docsearch/css@3
4750

4851
extra_javascript:
4952
- js/hide-back-to-index.js
53+
- https://cdn.jsdelivr.net/npm/@docsearch/js@latest
54+
- js/init-algolia.js
5055

5156
markdown_extensions:
5257
- admonition
@@ -80,8 +85,8 @@ plugins:
8085
feed_title: "Percona Documentation What's New Feed"
8186
tags:
8287
tags_file: new/tags.md
83-
search:
84-
separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
88+
# search:
89+
# separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
8590
meta-descriptions:
8691
export_csv: false
8792
quiet: false
@@ -93,6 +98,10 @@ extra:
9398
analytics:
9499
provider: google
95100
property: G-J4J70BNH0G
101+
docsearch:
102+
api_key: "a5222c0ed6e9e6c67a77cfd2e26000e1"
103+
index_name: "Percona documentation"
104+
app_id: "QDKRBCAI99"
96105
# feedback:
97106
# title: Was this page helpful?
98107
# ratings:

overrides/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
</div>
7070
</div>
7171
</div>
72-
{% endif %}
72+
{% endif %}
7373
{% endblock %}

overrides/partials/header.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,7 @@
8585
{% include "partials/alternate.html" %}
8686
{% endif %}
8787

88-
<!-- Button to open search modal -->
89-
{% if "material/search" in config.plugins %}
90-
<label class="md-header__button md-icon" for="__search">
91-
{% set icon = config.theme.icon.search or "material/magnify" %}
92-
{% include ".icons/" ~ icon ~ ".svg" %}
93-
</label>
94-
95-
<!-- Search interface -->
96-
{% include "partials/search.html" %}
97-
{% endif %}
88+
<div id="docsearch" class="algolia-docsearch-container"></div>
9889

9990
<!-- Repository information -->
10091
{% if config.repo_url %}

0 commit comments

Comments
 (0)