Rick Cogley's Tech Logr

Short Technical Laser Bursts %%

RC Logr 20190516 184252

Thursday, 16 May, 2019

Static Site Generator Hugo has a relatively new «append» command made possible because of a golang upgrade, that lets you replace clumsier scratch constructs, which themselves were workarounds to begin with. I tried it for generating a search index for my logr site and it works as expected. Shiny! 🌞 The code is below and this is the result.

1
2
3
4
5
{{- $index := slice -}}
{{- range where .Site.RegularPages "Type" "not in"  (slice "jf2feed" "json") -}}
  {{- $index = $index | append (dict "title" .Title "ref" .Permalink "tags" .Params.tags "content" .Plain) -}}
{{- end -}}
{{- $index | jsonify -}}

RC Logr 20190516 184252 - Static Site Generator Hugo has … Rick Cogley
Back to Home Tweet Link