Browse Source

enabling alts for photos that have them

master
jk 4 years ago
parent
commit
141516256e
  1. 15
      layouts/_default/section.html
  2. 6
      themes/nipponalba/layouts/_default/single.html
  3. 6
      themes/nipponalba/layouts/index.html

15
layouts/_default/section.html

@ -20,15 +20,14 @@
{{ .Content }} {{ .Content }}
{{ if eq .Type "photo"}} {{ if eq .Type "photo"}}
<section class="photogrid"> <section class="photogrid">
{{$link := .Permalink}}
{{$summary := .Content}}
{{ range .Page.Params.Photo }} {{ range .Page.Params.Photo }}
<a class="u-url" href="{{ . }}">
<picture>
<source media="max-width:960px" srcset="{{ . }}">
<source media="max-width:480px" srcset="{{ replace . "800." "300."}}">
<img class="u-photo thumb" src="{{ replace . "800." "300."}}" srcset="{{ . }} 960w, {{ replace . "800." "300."}} 480w"/>
</picture>
</a>
{{end}}
{{ if isset . "value" }}
<a href="{{ $link }}" class="u-url"><img class="u-photo thumb" src="{{ replace .value "800." "300."}}" title="{{ $summary }}" alt="{{ .alt }}"/></a>
{{ else }}
<a href="{{ $link }}" class="u-url"><img class="u-photo thumb" src="{{ replace . "800." "300."}}" title="{{ $summary }}" alt="Alt not yet added, will fix!"/></a>
{{end}}{{end}}
</section> </section>
{{end}} {{end}}
</section><br/> </section><br/>

6
themes/nipponalba/layouts/_default/single.html

@ -15,7 +15,11 @@
{{ if eq .Type "photo"}} {{ if eq .Type "photo"}}
<section class="photogrid"> <section class="photogrid">
{{ range .Page.Params.Photo }} {{ range .Page.Params.Photo }}
<a href="{{ . }}"><img class="u-photo thumb" src="{{ replace . "800." "300."}}"/></a>
{{ if in . "value" }}
<a href="{{ .value }}"><img class="u-photo" src="{{ .value }}" alt="{{ .alt }}"/></a>
{{ else }}
<a href="{{ . }}"><img class="u-photo" src="{{ . }}" alt="Alt not yet added, will fix!"/></a>
{{end}}
{{end}} {{end}}
</section> </section>
{{end}} {{end}}

6
themes/nipponalba/layouts/index.html

@ -39,7 +39,11 @@
{{ if eq .Type "photo"}} {{ if eq .Type "photo"}}
<section class="photos"> <section class="photos">
{{ range .Page.Params.Photo }} {{ range .Page.Params.Photo }}
<a class="u-url" href="{{ . }}"><img class="u-photo thumb" src="{{ replace . "800." "300."}}"/></a>
{{ if isset . "value" }}
<a class="u-url" href="{{ . }}"><img class="u-photo thumb" src="{{ replace .value "800." "300."}}" alt="{{ .alt }}"/></a>
{{ else }}
<a class="u-url" href="{{ . }}"><img class="u-photo thumb" src="{{ replace . "800." "300."}}" alt="Alt not yet added, will fix!"/></a>
{{ end }}
{{end}} {{end}}
</section> </section>
{{end}} {{end}}