diff options
author | Patrick Collins <thepatrickcollins@gmail.com> | 2017-12-10 23:06:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-10 23:06:47 +0300 |
commit | 3b30bf0b62ea4341d0f72504d9ecb6a6eeda22fb (patch) | |
tree | cf94741fc3a75231ce0cc7c474c4dffde97d6474 | |
parent | 88c21a682b7c46d9fee39e9e58ad46df513717ed (diff) |
Simplify img-path shortcode to reduce parsing errors (#91)
* Simplify shortcode to reduce issues with mini-posts
* Style
* Remove comment for shortcode to work
-rw-r--r-- | layouts/partials/img-path.html | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/layouts/partials/img-path.html b/layouts/partials/img-path.html index 8f82671..e6b796e 100644 --- a/layouts/partials/img-path.html +++ b/layouts/partials/img-path.html @@ -9,25 +9,19 @@ otherwise use the explicit path provided by the user --> -{{ $path := $.Scratch.Get "path" }} + +{{ $src := $.Scratch.Get "path" }} {{ $alt := $.Scratch.Get "featuredalt" }} {{ $img := $.Scratch.Get "featured" }} {{ $structType := $.Scratch.Get "structType" }} -{{ if eq $path "title" }} - {{ $.Scratch.Set "path" "/img/" }} - {{ if eq $structType "shortcode" }} - {{ $.Scratch.Add "path" (lower (replace .Page.LinkTitle " " "-")) }} - {{ else }} - {{ $.Scratch.Add "path" (lower (replace .LinkTitle " " "-")) }} - {{ end }} -{{ else if eq $path "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 }} +{{ 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" $path }} + {{ $.Scratch.Set "path" $src }} {{ end }} |