buro9 / microcosm

Front end for Microcosm, a Go web server that serves the static files, templates and performs API calls.
GNU Affero General Public License v3.0
11 stars 3 forks source link

47 convert search #138

Closed buro9 closed 2 years ago

buro9 commented 2 years ago

TIL that this produces a nil pointer deference:

<a href="{{ (microcosm_link $parent.Meta.Links "microcosm").Href | microcosm_api2ui }}">{{ (microcosm_link $parent.Meta.Links "microcosm").Title | safeHTML }}</a>

And the way to get around that is this:

{{ with (microcosm_link $parent.Meta.Links "microcosm") }}
    <a href="{{ .Href | microcosm_api2ui }}">{{ .Title | safeHTML }}</a>
{{ end }}