URI: 
       tpl: Update Twitter card to also consider images in .Resources - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 25d691daff57d7c6d7d0f63af3991d22e3f788fe
   DIR parent df20b05463fef42aba93d5208e410a7ecc56da5d
  HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Mon, 29 Jan 2018 11:44:41 +0100
       
       tpl: Update Twitter card to also consider images in .Resources
       
       The new lookup order:
       
       1) Page.Params.images if set
       2) Image resources: images with name "feature" (priority), "cover", "thumbnail"
       3) Site.Params.images if set
       
       Fixes #4349
       
       Diffstat:
         M tpl/tplimpl/template_embedded.go    |      15 ++++++++++++++-
       
       1 file changed, 14 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/tpl/tplimpl/template_embedded.go b/tpl/tplimpl/template_embedded.go
       @@ -231,12 +231,25 @@ func (t *templateHandler) embedTemplates() {
        <!-- Facebook Page Admin ID for Domain Insights -->
        {{ with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}`)
        
       -        t.addInternalTemplate("", "twitter_cards.html", `{{- with $.Param "images" -}}
       +        t.addInternalTemplate("", "twitter_cards.html", `{{- with $.Params.images -}}
       +<meta name="twitter:card" content="summary_large_image"/>
       +<meta name="twitter:image:src" content="{{ index . 0 | absURL }}"/>
       +{{ else -}}
       +{{- $images := $.Resources.ByType "image" -}}
       +{{- $featured := $images.GetMatch "*feature*" -}}
       +{{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}}
       +{{- with $featured -}}
       +<meta name="twitter:card" content="summary_large_image"/>
       +<meta name="twitter:image:src" content="{{ $featured.Permalink }}"/>
       +{{- else -}}
       +{{- with $.Site.Params.images -}}
        <meta name="twitter:card" content="summary_large_image"/>
        <meta name="twitter:image:src" content="{{ index . 0 | absURL }}"/>
        {{ else -}}
        <meta name="twitter:card" content="summary"/>
        {{- end -}}
       +{{- end -}}
       +{{- end }}
        <meta name="twitter:title" content="{{ .Title }}"/>
        <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
        {{ with .Site.Social.twitter -}}