update ready listing for search

* update json output
* add rss output
* change tags to a tag cloud style

Signed-off-by: Toshaan Bharvani <toshaan@vantosh.com>
remotes/1693381142243034077/jamesk-patch-1
Toshaan Bharvani 3 years ago
parent 057c82709f
commit 2d7be0befe

@ -3,8 +3,8 @@ title: "OpenPOWER Ready"
date: 2021-03-30 date: 2021-03-30
outputs: outputs:
- html - html
- rss
- json - json
- rss
draft: false draft: false
--- ---



@ -6,7 +6,7 @@
<div class="section-header"> <div class="section-header">
<div class="row"> <div class="row">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<h2 class="section-title text-center">{{ .Title }}</h2> <h1 class="section-title text-center">{{ .Title }}</h1>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -31,14 +31,14 @@
<form action="{{ .RelPermalink }}" onkeyup="executeInlineSearch()"> <form action="{{ .RelPermalink }}" onkeyup="executeInlineSearch()">
<input id="search-query" placeholder="Search..." name="s" autocomplete="off" search autofocus/> <input id="search-query" placeholder="Search..." name="s" autocomplete="off" search autofocus/>
</form> </form>
<div id="search-results"><h3 class="search-results-title mb-4">Matching pages</h3></div> <div id="search-results"><h3 class="search-results-title mb-4">Matching items</h3></div>
</div> </div>
<script id="search-result-template" type="text/x-js-template"> <script id="search-result-template" type="text/x-js-template">
<div class="search-results-summary" id="summary-${key}"> <div class="search-results-summary">
<h4><a class="search-item mb-4" href="${link}">${title}</a></h4> <div class="search-results" id="summary-${key}">
<p>${snippet} ... <a class="search-item-more" href="${link}">[more]</a></p> <h4><a class="search-item" href="${link}">${title}</a></h4>
${ isset tags }<p>${tags}</p>${ end } ${ isset tags }<p>${tags}</p>${ end }
${ isset categories }<p>Categories: ${categories}</p>${ end } </div>
</div> </div>
</script> </script>
</div> </div>

@ -40,12 +40,38 @@
{{ end }} {{ end }}
<li>Date Added : {{ .Date.Format "2 January 2006" }}</li> <li>Date Added : {{ .Date.Format "2 January 2006" }}</li>
</ul> </ul>
{{ if .Params.tags }}
{{ $tags := .Params.tags }}
<h4>Tags</h4> <h4>Tags</h4>
<ul id="tags"> <ul id="tags">
{{ range .Params.tags }} <li>
<li>{{ . }}</li> {{ if not (eq (len $.Site.Taxonomies.tags) 0) }}
{{ $fontUnit := "rem" }}
{{ $largestFontSize := 3.5 }}
{{ $smallestFontSize := 0.5 }}
{{ $fontSpread := sub $largestFontSize $smallestFontSize }}
{{ $max := add (len (index $.Site.Taxonomies.tags.ByCount 0).Pages) 1 }}
{{ $min := len (index $.Site.Taxonomies.tags.ByCount.Reverse 0).Pages }}
{{ $spread := sub $max $min }}
{{ $fontStep := div $fontSpread $spread }}
{{ range $name, $taxonomy := $.Site.Taxonomies.tags }}
{{ $currentTagCount := len $taxonomy.Pages }}
{{ $currentFontSize := (add $smallestFontSize (mul (sub $currentTagCount $min) $fontStep) ) }}
{{ $count := len $taxonomy.Pages }}
{{ $weigth := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
{{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth) ) }}
{{ range $tags }}
{{ if eq $name . }}
&nbsp;
<span style="font-size: {{ $currentFontSize }}{{ $fontUnit }}">{{ $name }}</span>
&nbsp;
{{ end }} {{ end }}
{{ end }}
{{ end }}
</li>
</ul> </ul>
{{ end }}
{{ end }}
</div> </div>
</div> </div>
<div class="row"> <div class="row">

Loading…
Cancel
Save