Skip to content

Commit f9e46c9

Browse files
committed
Allow searching by path, and display paths in results.
1 parent c8f6927 commit f9e46c9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ anchors = "off"
2828
include_title = true
2929
include_description = true
3030
include_date = false
31-
include_path = false
31+
include_path = true
3232
include_content = true
3333
index_format = "fuse_json"

sass/_search.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
margin: 0;
4747
}
4848

49+
#search-container:focus-within {
50+
width: 100%;
51+
}
52+
4953
#search-container:focus-within > #search-input {
5054
outline: 1px solid;
5155
border-color: var(--color-text);

static/search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Search {
2323
const a = document.createElement("a");
2424
a.setAttribute("class", "search-results-item");
2525
a.setAttribute("href", result.item.url);
26-
a.textContent = result.item.title;
26+
a.textContent = result.item.path;
2727

2828
// Update the focus on result items only via keyboard or when a cursor is
2929
// moved. This allows us to use a keyboard for searching even when a cursor
@@ -151,7 +151,7 @@ class Search {
151151
}
152152

153153
this.fuse = new Fuse(allData, {
154-
keys: ["title", "description", "body"],
154+
keys: ["title", "description", "body", "path"],
155155
ignoreLocation: true,
156156
useExtendedSearch: true,
157157
});

0 commit comments

Comments
 (0)