Add Stork support

main
Elnu 2 years ago
parent ce25ef91c6
commit 65853fccd2

@ -2,6 +2,10 @@
<html>
{{- partial "head.html" . -}}
<body>
{{ if .Site.Params.Stork }}
{{ partial "stork.html" . }}
<br>
{{ end }}
{{- partial "header.html" . -}}
<div id="content">
{{- block "main" . }}{{- end }}

@ -0,0 +1,46 @@
{{- /*
https://stork-search.net/
https://stork-search.net/docs/
https://stork-search.net/docs/config-ref
https://stork-search.net/themes
https://github.com/jameslittle230/stork
https://github.com/jameslittle230/stork/discussions
*/}}
{{- /* Configuration */}}
{{- $config := dict
"input" (dict
"base_directory" "public"
"exclude_html_selector" ".highlight"
"html_selector" "#main"
"title_boost" "Moderate"
)
"output" (dict
"displayed_results_count" 5
"excerpts_per_result" 3
"save_nearest_html_id" true
)
}}
{{- /* Build the files map */}}
{{- $files := slice }}
{{- range site.Sections }}
{{- if eq .Section "tests" }}
{{- continue }}
{{- end }}
{{- range .Pages }}
{{- $file := dict
"title" (trim (partial "content.html" .Title) "\n")
"url" .RelPermalink
"path" (path.Join (strings.TrimPrefix site.BaseURL .Permalink) "index.html")
"filetype" "HTML"
}}
{{- $files = $files | append $file }}
{{- end }}
{{- end }}
{{- /* Merge the files map into the configuration map */}}
{{- $config = merge $config (dict "input" (dict "files" $files)) }}
{{- /* Render */}}
{{- jsonify (dict "indent" " ") $config }}

@ -15,12 +15,14 @@
</details>
</aside>
{{ end }}
<main>
<article>
<header>
<h1>{{ partial "content.html" .Title }}</h1>
{{ partial "metadata.html" . }}
</header>
<br>
{{ partial "content.html" .Content }}
<div id="main">{{ partial "content.html" .Content }}</div>
</article>
</main>
{{ end }}

@ -0,0 +1,13 @@
<div class="stork-search">
<input data-stork="posts" placeholder="🔎 Search {{ .Site.Title }}...">
</div>
<div data-stork="posts-output"></div>
<link rel="stylesheet" href="/stork/stork.css">
<script src="/stork/stork.js"></script>
<script>
stork.initialize("/stork/stork.wasm");
stork.register(
"posts",
"/home.st"
);
</script>

@ -0,0 +1,55 @@
.stork-attribution {
display: none;
}
.stork-results {
list-style-type: none;
padding-left: 0;
margin-bottom: 0;
}
.stork-excerpt p, .stork-title p {
margin: 0;
}
.stork-excerpt p {
font-size: 0.875em;
}
.stork-title {
font-weight: bold;
}
.stork-search {
width: 100%;
height: 2em;
display: flex;
}
.stork-search > * {
height: 100%;
}
.stork-search input[data-stork] {
width: 100%;
}
.stork-search input[data-stork]:nth-last-child(3) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.stork-close-button, .stork-output-visible {
border-radius: 4px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.stork-progress {
display: none;
}
.stork-output-visible {
background: #f7f7f7;
padding: 0 0.5em;
}

File diff suppressed because one or more lines are too long

Binary file not shown.