File tree Expand file tree Collapse file tree 7 files changed +71
-5
lines changed Expand file tree Collapse file tree 7 files changed +71
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ gem "jekyll", "~> 4.3.3"
33gem "minima" , "~> 2.5.2"
44group :jekyll_plugins do
55 gem "jekyll-feed" , "~> 0.12"
6+ gem "jekyll-seo-tag"
67end
78platforms :mingw , :x64_mingw , :mswin , :jruby do
89 gem "tzinfo" , ">= 1" , "< 3"
Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ author:
33 name : " "
44 email : " "
55description : >
6- HMPL - 🐜 Server-oriented customizable
6+ HMPL - 🐜 Server-oriented customizable
77 templating for JavaScript
88theme : minima
99plugins :
1010 - jekyll-feed
11+ - jekyll-seo-tag
1112minima :
1213 social_links :
1314 - { platform: github, user_url: "https://github.com/hmpl-language/hmpl" }
Original file line number Diff line number Diff line change 44 {%- assign page_paths = site.header_pages | default: default_paths -%}
55 {%- assign titles_size = site.pages | map: 'title' | join: '' | size -%}
66 < a class ="site-title " rel ="author " href ="{{ "/" | relative_url }}"> {{ site.title | escape }}</ a >
7-
7+
88 < nav class ="site-nav ">
99 < input type ="checkbox " id ="nav-trigger " class ="nav-trigger " />
1010 < label for ="nav-trigger ">
1414 </ svg >
1515 </ span >
1616 </ label >
17-
1817 < div class ="trigger ">
1918 < a class ="page-link " href ="https://hmpl-lang.dev "> hmpl-lang.dev</ a >
2019 </ div >
20+ < label for ="search-box "> < input type ="text " id ="search-box " placeholder ="Search... ">
21+ < ul id ="results "> </ ul >
22+ </ label >
2123 </ nav >
2224 </ div >
2325</ header >
Original file line number Diff line number Diff line change 22< html lang ="{{ page.lang | default: site.lang | default: " en " }}">
33
44{%- include head.html -%}
5- < script src ="https://cdnjs.cloudflare. com/ajax/libs/ clipboard.js/2.0.11/clipboard.min .js "> </ script >
5+ < script src ="https://unpkg. com/clipboard.js "> </ script >
66< link rel ="stylesheet " href ="/css/style.css " />
77
88< body >
5050 } ) ;
5151 </ script >
5252
53+ < script src ="https://unpkg.com/lunr.js "> </ script >
54+ < script src ="/assets/search.js "> </ script >
55+
5356</ body >
5457
55- </ html >
58+ </ html >
Original file line number Diff line number Diff line change 1+ ---
2+ layout: nil
3+ ---
4+ [
5+ {% for post in site.posts %}
6+ {
7+ "title": "{{ post.title | escape | replace: '\u0000', '' }}",
8+ "url": "{{ post.url | relative_url }}",
9+ "datePublished": "{{ post.date | date_to_xmlschema }}",
10+ "dateModified": "{% if post.modified_date %}{{ post.modified_date | date_to_xmlschema }}{% else %}null{% endif %}",
11+ "author": [
12+ {% if post.author %}
13+ {% for author in post.author %}
14+ "{{ author | escape }}"{% if forloop.last == false %},{% endif %}
15+ {% endfor %}
16+ {% endif %}
17+ ]
18+ }{% unless forloop.last %},{% endunless %}
19+ {% endfor %}
20+ ]
Original file line number Diff line number Diff line change 1+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
2+ const searchBox = document . getElementById ( "search-box" ) ;
3+ const resultsList = document . getElementById ( "results" ) ;
4+
5+ fetch ( "/search.json" )
6+ . then ( ( response ) => response . json ( ) )
7+ . then ( ( data ) => {
8+ searchBox . addEventListener ( "input" , function ( ) {
9+ const query = this . value . toLowerCase ( ) ;
10+
11+ if ( query . trim ( ) === "" ) {
12+ resultsList . style . display = "none" ;
13+ } else {
14+ resultsList . style . display = "block" ;
15+ const results = data . filter ( ( post ) => {
16+ const title = post . title ? post . title . toLowerCase ( ) : "" ;
17+ return title . includes ( query ) ;
18+ } ) ;
19+
20+ // Display the filtered results
21+ resultsList . innerHTML = results
22+ . map (
23+ ( post ) => `
24+ <li>
25+ <a href="${ post . url } ">${ post . title } </a>
26+ </li>`
27+ )
28+ . join ( "" ) ;
29+ }
30+ } ) ;
31+ } )
32+ . catch ( ( error ) => {
33+ console . error ( "Error fetching search.json:" , error ) ;
34+ } ) ;
35+ } ) ;
Original file line number Diff line number Diff line change 1+ ---
2+ layout: json
3+ permalink: /search.json
4+ ---
You can’t perform that action at this time.
0 commit comments