hendry
June 11, 2020, 2:51am
1
Hi! In a section of my markdown, I’d like to do something like:
{{ $files := readDir /static/gallery }}
{{ range $files }}
<figure><img src="{{$url}}/{{.Name | urlize }}"></figure>
{{ end }}
But it doesn’t work of course when I try. I am not sure what I’m supposed to do here.
Create a shortcode? Move the content a layouts/mypage.html instead?
hendry
June 11, 2020, 7:37am
3
Thank you! The syntax is really gnarly. I don’t understand the point of it.
{{< couldbeanything.inline >}}
Go template
{{< /couldbeanything.inline >}}
ju52
June 11, 2020, 10:12am
4
I made this thing with fancybox as gallery viewer.
my sample tamplete is here:
{{ define "main" }}
<header>
<h1><span class="dn di-l">{{ site.Title | markdownify }} </span><i class="fas fa-dragon fa-fw"></i> {{ .Page.Title | markdownify }}</h1>
{{ partial "single-head" . }}
</header>
<article>
{{ with .Content}}{{ . }}<br/>{{end}}
{{range .Resources.Match "gallery/*" -}}{{$alt := .Name}}{{ $image := .Fit "360x240 jpg #ffffff q75" }}{{ $preview := .Fit "30x20 jpg #ffffff q50" }} {{ $title := ""}}
<a data-fancybox=gallery href={{.RelPermalink}}><figure><img
loading=lazy class=foto src={{ $image.RelPermalink }}
width={{ $image.Width }} height={{ $image.Height }} alt="{{ $alt }}" title="{{$title}}"
style="background: url(data:image/jpeg;base64,{{ $preview.Content | base64Encode }}); background-size:100% 100%;" /></figure></a>
{{- end }}
{{ partial "prevnext" .}}
</article>
{{ end }}
system
Closed
June 13, 2020, 10:12am
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.