Skip to content

Commit 3b68da6

Browse files
authored
Enhance search (#75)
* Updated JSON feed: - Moved JSON feed file to `packages.json` - Added `json_path` to Jekyll configuration for new JSON feed - Added `search_path` to Jekyll configuration for search page - Updated JavaScript search to point to new JSON feed - Updated default template to utilize configured variables for navigation links * Modularize JavaScript search: - Modified JavaScript search into module - Moved JavaScript to module directory - Updated search page to import JavaScript module and provide configuration object * Updated search with templates: - Updated search JavaScript with templates for results, zero results, and no query - Updated search page with templates configuration and templates - Updated custom style sheet to modify search view * Updated search with fuzzy search: - Updated search JavaScript with Fuse fuzzy search module and associated code - Updated search page results template to include additional details - Updated custom style sheet to add highlight rules - Updated JSON feed to simplify package URLs * Update search with hotkeys: - Updated search JavaScript with HotKeys keybindings module and associated code - Updated search page keybinding configuration - Updated custom style sheet to add selection rule * Applied @Potherca suggestions: - Correcting strict-type comparison - Moved ternary operators to beginning of lines - Added braces to all if flow blocks * Applied @jwerle suggestion: - Added `catch` in `_fetchFeed` function
1 parent 2b6727b commit 3b68da6

File tree

7 files changed

+601
-75
lines changed

7 files changed

+601
-75
lines changed

Diff for: _config.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,14 @@ JB :
104104
# These paths are to the main pages Jekyll-Bootstrap ships with.
105105
# Some JB helpers refer to these paths; change them here if needed.
106106
#
107-
archive_path : /archive/index.html
107+
archive_path : /archive
108+
packages_path : /packages/name
109+
tags_path : /packages/tag
108110
categories_path : /packages/category
109-
tags_path : /packages/tag/
111+
search_path : /search
110112
atom_path : /feed/atom.xml
111113
rss_path : /feed/rss.xml
114+
json_path : /feed/packages.json
112115

113116
# Settings for comments helper
114117
# Set 'provider' to the comment provider you want to use.

Diff for: _includes/themes/the-program/default.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
<ul>
2828
<li class="logo"><a href="/">{{ site.title }}</a></li>
2929

30-
<li class="archive"><a href="/packages/name">Packages by Name</a></li>
31-
<li class="archive"><a href="/packages/tag">Packages by Tag</a></li>
32-
<li class="archive"><a href="/packages/category">Packages by Category</a></li>
30+
<li class="archive"><a href="{{ site.JB.packages_path }}">Packages by Name</a></li>
31+
<li class="archive"><a href="{{ site.JB.tags_path }}">Packages by Tag</a></li>
32+
<li class="archive"><a href="{{ site.JB.categories_path }}">Packages by Category</a></li>
3333

3434
<li class="archive">&nbsp;</li>
35-
<li class="archive"><a href="/search">Search Packages</a></li>
35+
<li class="archive"><a href="{{ site.JB.search_path }}">Search Packages</a></li>
3636

3737
<!-- github buttons -->
3838
<li class="forkme">

Diff for: assets/custom.css

+57
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,60 @@ tr:hover td {
9999
column-span: all;
100100
margin-bottom: 0.25em;
101101
}
102+
103+
#search + #results {
104+
margin-top: 1em;
105+
}
106+
#search + #results .noResults img {
107+
margin: 0 auto;
108+
width: 10vw;
109+
}
110+
#search + #results li {
111+
border-left: 3px solid rgba(0, 0, 0, 0);
112+
list-style-type: none;
113+
}
114+
#search + #results li.selected {
115+
border-left-color: rgba(254, 121, 49, 0.5);
116+
}
117+
#search + #results li .result {
118+
border-top: 1px solid rgba(0, 0, 0, 0.25);
119+
}
120+
#search + #results li:first-child .result {
121+
border-top: 0;
122+
}
123+
#search + #results .result {
124+
font-size: 0.85em;
125+
line-height: 1.5em;
126+
margin-left: 0.5em;
127+
padding-left: 0.5em;
128+
}
129+
#search + #results .result a {
130+
text-decoration: none;
131+
}
132+
#search + #results .result p {
133+
margin: 0;
134+
}
135+
#search + #results .result .result-title {
136+
font-size: 1.15em;
137+
line-height: 2em;
138+
}
139+
#search + #results .result label {
140+
font-weight: bolder;
141+
}
142+
#search + #results .result .result-repository {
143+
font-size: 0.9em;
144+
}
145+
.highlight.match-group-0 { background-color: #d5ebff; }
146+
.highlight.match-group-1 { background-color: #c4e8ac; }
147+
.highlight.match-group-2 { background-color: #f6d7a6; }
148+
.highlight.match-group-3 { background-color: #c8c8ff; }
149+
.highlight.match-group-4 { background-color: #f2cfff; }
150+
.highlight.match-group-5 { background-color: #ffc5bf; }
151+
.highlight.match-group-6 { background-color: #c8e7d6; }
152+
.highlight.match-group-7 { background-color: #9fcfff; }
153+
.highlight.match-group-8 { background-color: #9fcba1; }
154+
.highlight.match-group-9 { background-color: #e0bf8b; }
155+
.highlight.match-group-10 { background-color: #acadfc; }
156+
.highlight.match-group-11 { background-color: #e1abf5; }
157+
.highlight.match-group-12 { background-color: #ef9b95; }
158+
.highlight.match-group-13 { background-color: #abe2d0; }

0 commit comments

Comments
 (0)