You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.5 KiB
58 lines
2.5 KiB
{{ define "main" }}
|
|
<!-- The "search" layout renders the search engine -->
|
|
<article class="search article-list">
|
|
<header>
|
|
<h1>{{ .Title }}</h1>
|
|
{{- with .Description }}
|
|
<h4>{{ . }}</h4>
|
|
{{- end }}
|
|
</header>
|
|
{{ .Content }}
|
|
<input id="searchInput" tabindex="0" placeholder="{{ i18n "search_here" }}" autofocus>
|
|
<div id="searchResults">
|
|
</div>
|
|
<div style="display: none;" id="image-store">
|
|
{{- range $_, $file := (slice "en" "fr" "label" "link" "schedule") -}}
|
|
<div id="embedded-svg-{{ $file }}">
|
|
{{- partial (printf "icons/%s.svg" $file) . -}}
|
|
</div>
|
|
{{- end }}
|
|
</div>
|
|
{{- /*
|
|
-- The search data are embedded in a JSON data block, used by /js/search.js
|
|
*/ -}}
|
|
{{- /* Taxonomies */ -}}
|
|
{{- $.Store.Set "taxonomies" dict -}}
|
|
{{- range $name, $taxonomy := .Site.Taxonomies -}}
|
|
{{- $.Store.Set "taxonomy" dict -}}
|
|
{{- range (index $.Site.Taxonomies $name) -}}
|
|
{{- $.Store.SetInMap "taxonomy" .Page.Title (dict "href" .Page.RelPermalink "title" .Page.Title) -}}
|
|
{{- end -}}
|
|
{{- $.Store.SetInMap "taxonomies" $name ($.Store.Get "taxonomy") -}}
|
|
{{- end }}
|
|
|
|
{{- /* Search index */ -}}
|
|
{{- $.Store.Set "index" slice -}}
|
|
{{- range .Site.RegularPages -}}
|
|
{{- $.Store.Set "reading_time" nil -}}
|
|
{{- if eq .Type "blog" -}}
|
|
{{- $minutes := .ReadingTime -}}
|
|
{{- if gt $minutes 0 -}}
|
|
{{- $.Store.Set "reading_time" (i18n "minutes" $minutes) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- $.Store.Set "date" nil -}}
|
|
{{- if ne .Type "page" -}}
|
|
{{- $.Store.Set "date" (.Date.Format (i18n "date_format")) -}}
|
|
{{- end -}}
|
|
|
|
{{ .Store.Set "en_article_in_fr_site" false }}
|
|
{{- partial "lang-detection.html" . -}}
|
|
{{- $.Store.Add "index" (dict "title" .Title "opensource" .Params.opensource "topics" .Params.topics "permalink" .Permalink "hasEnFlag" (.Store.Get "en_article_in_fr_site") "type" .Type "type_label" (i18n (print "type_" .Type)) "date" ($.Store.Get "date") "reading_time" ($.Store.Get "reading_time") "summary" (.Summary | plainify | htmlUnescape)) -}}
|
|
{{- end }}
|
|
{{- $data := dict "taxonomies" ($.Store.Get "taxonomies") "index" ($.Store.Get "index") "i18n" (dict "published_on" (i18n "published_on") "continue_reading" (i18n "continue_reading")) }}
|
|
<script type="application/json" id="search-data">{{ $data | jsonify | safeJS }}</script>
|
|
<script src="/js/search.js"></script>
|
|
</article>
|
|
{{ end }}
|
|
|