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>
jamesk-patch-1
Toshaan Bharvani 2 years ago
parent 057c82709f
commit 2d7be0befe

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


@ -6,7 +6,7 @@
<div class="section-header">
<div class="row">
<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 class="row">
@ -31,15 +31,15 @@
<form action="{{ .RelPermalink }}" onkeyup="executeInlineSearch()">
<input id="search-query" placeholder="Search..." name="s" autocomplete="off" search autofocus/>
</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>
<script id="search-result-template" type="text/x-js-template">
<div class="search-results-summary" id="summary-${key}">
<h4><a class="search-item mb-4" href="${link}">${title}</a></h4>
<p>${snippet} ... <a class="search-item-more" href="${link}">[more]</a></p>
<div class="search-results-summary">
<div class="search-results" id="summary-${key}">
<h4><a class="search-item" href="${link}">${title}</a></h4>
${ isset tags }<p>${tags}</p>${ end }
${ isset categories }<p>Categories: ${categories}</p>${ end }
</div>
</div>
</script>
</div>
<div class="col-lg-2">&nbsp;</div>

@ -40,12 +40,38 @@
{{ end }}
<li>Date Added : {{ .Date.Format "2 January 2006" }}</li>
</ul>
<h4>Tags</h4>
<ul id="tags">
{{ range .Params.tags }}
<li>{{ . }}</li>
{{ if .Params.tags }}
{{ $tags := .Params.tags }}
<h4>Tags</h4>
<ul id="tags">
<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 }}
</li>
</ul>
{{ end }}
{{ end }}
</ul>
</div>
</div>
<div class="row">

Loading…
Cancel
Save