swh:1:snp:9f90daa2f0cb7e83b3230a52ab396e3b6448c798
Tip revision: a190f270da39746f098672680944a4e33da8044b authored by LuisGC on 18 February 2018, 19:37:23 UTC
Merge branch 'master' of https://github.com/LuisGC/blog into hugo
Merge branch 'master' of https://github.com/LuisGC/blog into hugo
Tip revision: a190f27
img-path.html
<!-- This partial is used by the img shortcodes and the template,
featured in the post type
Set the path depending on the value passed through
if path is title then it will use the LinkTitle from the Page variable
if path is date then it will format the directory to year/date i.e. 2006/01
Note: path will be concatenated to the root directory, img
otherwise use the explicit path provided by the user
-->
{{ $src := $.Scratch.Get "path" }}
{{ $alt := $.Scratch.Get "featuredalt" }}
{{ $img := $.Scratch.Get "featured" }}
{{ $structType := $.Scratch.Get "structType" }}
{{ if eq $src "date" }}
{{ $.Scratch.Set "path" "/img/" }}
{{ if eq $structType "shortcode" }}
{{ $.Scratch.Add "path" (.Page.Date.Format "2006/01") }}
{{ else }}
{{ $.Scratch.Add "path" (.Date.Format "2006/01") }}
{{ end }}
{{ else }}
{{ $.Scratch.Set "path" $src }}
{{ end }}