Add search list pages
This commit is contained in:
parent
9a4039237c
commit
3d5e7d16b8
6 changed files with 45 additions and 10 deletions
6
content/search.md
Normal file
6
content/search.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
title: Search
|
||||||
|
layout: search
|
||||||
|
---
|
||||||
|
|
||||||
|
test
|
|
@ -1,15 +1,6 @@
|
||||||
{
|
{
|
||||||
{{ range $i, $e := .Data.Pages.ByTitle }}
|
{{ range $i, $e := .Data.Pages.ByTitle }}
|
||||||
{{ if $i }}, {{ end }}
|
{{ if $i }}, {{ end }}
|
||||||
"{{ .RelPermalink }}": {
|
{{ partial "page_data.json" . }}
|
||||||
"id": "{{ .UniqueID }}",
|
|
||||||
"title": "{{ lower .Title }}",
|
|
||||||
"date": "{{ .Date }}",
|
|
||||||
"url": "{{ .Permalink }}",
|
|
||||||
"link": "{{ .RelPermalink }}",
|
|
||||||
"link_title": "{{ .LinkTitle }}",
|
|
||||||
"parent": "{{ if .Parent }}{{ lower .Parent.Title }}{{ end }}",
|
|
||||||
"tags": {{ jsonify .Params.tags }}
|
|
||||||
}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
}
|
}
|
||||||
|
|
12
layouts/_default/search.html
Normal file
12
layouts/_default/search.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{{ partial "page_start.html" . }}
|
||||||
|
<section id="main" class="container">
|
||||||
|
{{ partial "content.html" . }}
|
||||||
|
|
||||||
|
<div class="row search-results">
|
||||||
|
{{ $valid_pages := where (where .Site.Pages.ByTitle "Kind" "page") ".Parent" "!=" nil }}
|
||||||
|
{{ range $valid_pages }}
|
||||||
|
{{ partial "box_image.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{ partial "page_end.html" . }}
|
8
layouts/_default/search.json
Normal file
8
layouts/_default/search.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{{ $valid_pages := where (where .Site.Pages.ByTitle "Kind" "page") ".Parent" "!=" nil }}
|
||||||
|
|
||||||
|
{
|
||||||
|
{{ range $i, $e := $valid_pages }}
|
||||||
|
{{ if $i }}, {{ end }}
|
||||||
|
{{ partial "page_data.json" . }}
|
||||||
|
{{ end }}
|
||||||
|
}
|
8
layouts/_default/search.txt
Normal file
8
layouts/_default/search.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# {{ .Title | plainify }}
|
||||||
|
|
||||||
|
{{ .RawContent | safeHTML }}
|
||||||
|
|
||||||
|
{{ $valid_pages := where (where .Site.Pages.ByTitle "Kind" "page") ".Parent" "!=" nil }}
|
||||||
|
{{ range $valid_pages }}
|
||||||
|
- ![{{ title .LinkTitle }}]({{ .Permalink }})
|
||||||
|
{{ end }}
|
10
layouts/partials/page_data.json
Normal file
10
layouts/partials/page_data.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
"{{ .RelPermalink }}": {
|
||||||
|
"id": "{{ .UniqueID }}",
|
||||||
|
"title": "{{ lower .Title }}",
|
||||||
|
"date": "{{ .Date }}",
|
||||||
|
"url": "{{ .Permalink }}",
|
||||||
|
"link": "{{ .RelPermalink }}",
|
||||||
|
"link_title": "{{ .LinkTitle }}",
|
||||||
|
"parent": "{{ if .Parent }}{{ lower .Parent.Title }}{{ end }}",
|
||||||
|
"tags": {{ jsonify .Params.tags }}
|
||||||
|
}
|
Loading…
Reference in a new issue