dot-hugo/layouts/partials/banner.html

39 lines
1.2 KiB
HTML
Raw Normal View History

{{ "<!-- banner -->" | safeHTML }}
2020-02-08 04:40:37 +00:00
<div class="container section">
2019-12-03 07:42:06 +00:00
<div class="row">
<div class="col-lg-8 text-center mx-auto">
2020-02-08 04:40:37 +00:00
<h1 class="text-white mb-3">{{ .Site.Params.banner.title | markdownify }}</h1>
<p class="text-white mb-4">{{ .Site.Params.banner.subtitle | markdownify }}</p>
2019-12-03 07:42:06 +00:00
<div class="position-relative">
<input id="search" class="form-control" placeholder="{{ .Site.Params.banner.placeholder }}">
2020-04-05 06:48:34 +00:00
<i class="ti-search search-icon"></i>
2019-12-03 07:42:06 +00:00
<!-- Javascript -->
{{ $currentNode := . }}
{{ $currentNode.Scratch.Set "pages" .Site.Pages }}
{{ $pages := ($currentNode.Scratch.Get "pages") }}
<script>
$(function() {
var projects = [
{{ range $pages }}
{
value: "{{ .Title }}",
2020-02-22 10:12:51 +00:00
label: "<p>{{.Plain}}</p>{{range.Params.Keywords}}<p>{{.}}</p>{{end}}",
2019-12-03 07:42:06 +00:00
url:"{{ .Permalink }}"
},
{{ end }}
];
$( "#search" ).autocomplete({
2020-02-15 11:34:02 +00:00
source: projects
2019-12-03 07:42:06 +00:00
})
.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
return $( "<li>" )
2020-02-15 11:34:02 +00:00
.append( "<a href=" + item.url + " + \" &quot;\" + >" + item.value + "</a>" + item.label )
2019-12-03 07:42:06 +00:00
.appendTo( ul );
};
});
</script>
</div>
</div>
</div>
</div>
{{ "<!-- /banner -->" | safeHTML }}