-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8c71f7
commit f51d1cf
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{{ define "main" }} <!-- https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae --> | ||
|
||
<div class="search" style="padding-left: 10px;padding-right: 10px;min-height:500px;"> | ||
<header> | ||
<h1>{{ .Title }}</h1> | ||
{{/* partial "debugprint.html" (site.GetPage "/search") */}} | ||
</header> | ||
|
||
<!-- | ||
<form action="{{ .Permalink }}"> | ||
<input id="search-query" name="q"/> | ||
</form> | ||
--> | ||
|
||
<br> | ||
|
||
<div id="loader" class="center"></div> | ||
<div id="search-results"></div> | ||
</div> | ||
|
||
<script> | ||
var deletes = document.getElementById('loader'); | ||
setInterval(() => { | ||
let searchResults = document.getElementById('search-results') | ||
if (searchResults.textContent != '') deletes.remove() | ||
}, 1000) | ||
</script> | ||
|
||
</div> | ||
|
||
<template id="search-result-template"><div class="search_summary"> | ||
<h2 class="post-title no-text-decoration"><a class="search_link search_title" href=""></a></h2> | ||
<p><em class="search_snippet"></em></p> | ||
<small> | ||
<table> | ||
<tr class="search_iftags"><td><strong>Tags </strong></td><td class="search_tags"></td></tr> | ||
<tr class="search_ifcategories"><td><strong>Categories </strong></td><td class="search_categories"></td></tr> | ||
</table> | ||
</small> | ||
<br> | ||
</div></template> | ||
<!-- If you don't need IE 11 support you can remove this next script block --> | ||
<script type="text/javascript"> | ||
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later | ||
if (window.navigator.userAgent.indexOf('Trident/') > 0) { | ||
let urls = [ | ||
{{ "js/libs/iecompat/promises.min.js" | absURL }}, | ||
{{ "js/libs/iecompat/fetch.min.js" | absURL }}, | ||
{{ "js/libs/iecompat/template.min.js" | absURL }}, | ||
{{ "js/libs/iecompat/remove.min.js" | absURL }} | ||
]; | ||
let head = document.getElementsByTagName("head")[0]; | ||
urls.forEach(function(url) { | ||
let script = document.createElement("script"); | ||
script.src = url; | ||
head.appendChild(script); | ||
}); | ||
} | ||
// @license-end | ||
</script> | ||
<!-- These are the two libraries needed for current browsers. --> | ||
<script src={{ "js/libs/fuse.js/3.2.1/fuse.min.js" | absURL }}></script> | ||
<script src={{ "js/libs/mark.js/9.0.0/mark.min.js" | absURL }}></script> | ||
|
||
<!-- Below works *only if* this theme component is named "hugo-search-fuse-js" | ||
AND *if* the themesDir is left at the default value of "themes". --> | ||
{{ $search_js_md5 := (readFile "themes/hugo-search-fuse-js/static/js/search.js" | md5) }} | ||
<script src={{ printf "%s?%s" ("js/search.js" | absURL) $search_js_md5 }}></script> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{- $nav := . -}} | ||
{{- if or $nav.showCategories $nav.showTags $nav.custom -}} | ||
<div class="nav wrap"><nav class="nav"> | ||
<!-- Search input--> | ||
<form action="{{- `/search/` | relLangURL -}}" class="nav item"> | ||
<input id="search-query" placeholder="Search.." name="q"/></form> | ||
{{- if $nav.showCategories -}} | ||
<a class="nav item" href="{{- `/categories/` | relLangURL -}}">{{- T "Categories" -}}</a> | ||
{{- end -}} | ||
{{- if $nav.showTags -}} | ||
<a class="nav item" href="{{- `/tags/` | relLangURL -}}">{{- T "Tags" -}}</a> | ||
{{- end -}} | ||
{{- range $nav.custom -}} | ||
{{- $url := replace .url "#" "%23" -}} | ||
{{- $url = replace $url "." "%2e" -}} | ||
{{- $url = $url | safeURL -}} | ||
{{- if strings.HasPrefix $url "/" -}}{{- $url = $url | relLangURL -}}{{- end -}} | ||
<a class="nav item" href="{{- $url -}}" | ||
{{- if strings.HasPrefix $url "http" -}}target="_blank" rel="noopener noreferrer" | ||
{{- end -}}>{{- .title -}}</a> | ||
{{- end -}} | ||
</nav></div> | ||
{{- end -}} |