Skip to content

Commit

Permalink
[fix] Fix pages repeat.
Browse files Browse the repository at this point in the history
  • Loading branch information
loveminimal committed Mar 20, 2024
1 parent 5640f59 commit e5aa30c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions layouts/partials/_search.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<div class="container-search">
<div id="data" style="display: none;">
{{ range .Site.Pages }}
{{ if ne .Title "Secrets" }}
[{{ range .Pages }}
{{- dict
{{ range where .Site.Pages "Kind" "page" }}
{{ if (and (ne .Section "snippets"))}}
[{{- dict
"title" (lower .Title)
"permalink" .Permalink
"date" (.Date | time.Format "2006-01-02")
"summary" .Summary
"content" (lower .Plain)
| jsonify -}},{{ end }}]
| jsonify -}},]
{{ end }}
{{ end }}
</div>
Expand Down
1 change: 1 addition & 0 deletions static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let data = document.querySelector('#data').innerText.trim();
data = data.slice(0, data.length - 2) + ']';
data = data.replace(/\]\s+\[/g, '');
let map = JSON.parse(data);
console.log(map);

let scClear = document.querySelector('#sc-clear');
let scInput = document.querySelector('#sc-input');
Expand Down

0 comments on commit e5aa30c

Please sign in to comment.