1- <!-- HTML elements for search -->
1+ <!-- Pagefind search UI -->
22
33< div class ="search-area ">
4- < input type ="text " id ="search-input " placeholder ="Dig through the findings... ">
5- < ul id ="results-container "> </ ul >
6-
7- {% capture result_elem %}
8-
9- < div class ="card ">
10- < a href ="{url} ">
11- < div class ="card-body visible ">
12-
13- < div class ="card-image ">
14- < img src ="{{ site.baseurl }}/images/{type}s/{title}/banner-image.png " alt ="Image not available ">
15- </ div >
16-
17- < div class ="card-content ">
18-
19- < h3 class ="card-title ">
20- {title}
21- </ h3 >
22-
23- < div class ="card-meta ">
24- < i class ="fas fa-robot fa-sm "> </ i >
25- {authors}
26- < i class ="fas fa-calendar-alt fa-sm "> </ i >
27- {publish-date}
28- < i class ="fas fa-hashtag fa-sm "> </ i >
29-
30- < span class ="page-tags ">
31- {tags}
32- </ span >
33-
34- <!-- {% if doi != null %}
35- <span class="doi" style="background-image: url(https://zenodo.org/badge/DOI/{doi}.svg);">{doi}</span>
36- {% else %}
37- <p><span class="card-peer-review" style="
38- font-style: italic;
39- font-size: 1.3vw;
40- ">Under peer review</span></p>
41- {% endif %} -->
42- </ div >
43-
44- < div class ="card-summary ">
45- < p >
46- {summary}
47- </ p >
48- </ div >
49-
50- </ div >
51-
52- </ div >
53- </ a >
54- </ div >
55-
56-
57-
58- <!-- <a href="{url}">
59- <li class="result">
60- <h4 class="result-title">
61- {title}
62- </h4>
63- <p>{authors} | {tags}</p>
64- <p>{summary}</p>
65- </li>
66- </a> -->
67- {% endcapture %}
4+ < div id ="search "> </ div >
685</ div >
696
70-
71-
72-
73-
74- <!-- {% capture not_found %}<p class="mt-5">No results found</p>{% endcapture %} -->
75-
76- < script src ="{{site.baseurl}}/assets/js/simple-jekyll-search.js "> </ script >
77- <!-- <script src="https://unpkg.com/simple-jekyll-search@latest/dest/simple-jekyll-search.min.js"></script> -->
78-
7+ < link href ="/pagefind/pagefind-ui.css " rel ="stylesheet ">
8+ < script src ="/pagefind/pagefind-ui.js "> </ script >
799< script >
80- simpleJekyllSearch = new SimpleJekyllSearch ( {
81- searchInput : document . getElementById ( 'search-input' ) ,
82- resultsContainer : document . getElementById ( 'results-container' ) ,
83- json : '{{ site.baseurl }}/search.json' ,
84- searchResultTemplate : '{{ result_elem | strip_newlines }}' ,
85- noResultsText : '<div id="no-results">No results found</div>' ,
86- fuzzy : false ,
87- exclude : [ 'search.json' , 'nav/about.md' , 'nav/submission-guidelines.md' ]
88- } )
10+ function initPagefind ( ) {
11+ var el = document . getElementById ( 'search' ) ;
12+ if ( el && ! el . hasChildNodes ( ) ) {
13+ new PagefindUI ( {
14+ element : "#search" ,
15+ showImages : true ,
16+ showEmptyFilters : false ,
17+ resetStyles : false ,
18+ excerptLength : 30 ,
19+ translations : {
20+ placeholder : "Dig through the findings..." ,
21+ zero_results : "No results for [SEARCH_TERM]"
22+ }
23+ } ) ;
24+ }
25+ }
26+ window . addEventListener ( 'DOMContentLoaded' , initPagefind ) ;
27+ window . addEventListener ( 'pageshow' , function ( e ) {
28+ if ( e . persisted ) { // restored from bfcache — reinitialize
29+ var el = document . getElementById ( 'search' ) ;
30+ if ( el ) el . innerHTML = '' ;
31+ initPagefind ( ) ;
32+ }
33+ } ) ;
8934</ script >
0 commit comments