diff options
| -rw-r--r-- | layouts/partials/templates/opengraph.html | 8 | ||||
| -rw-r--r-- | layouts/partials/templates/twitter_cards.html | 8 |
2 files changed, 4 insertions, 12 deletions
diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index 5b81f94..89f1797 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -6,12 +6,8 @@ {{- $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png" ) -}} -{{- $image := "" -}} -{{- with .Params.featured_image -}} - {{- $image := .Resources.GetMatch .Params.featured_image -}} -{{- end -}} - -{{- if and .IsPage $image }} +{{- if and .IsPage .Params.featured_image -}} + {{- $image := .Resources.GetMatch .Params.featured_image }} <meta property="og:image" content="{{ $image.Permalink }}"> <meta property="og:image:width" content="{{ $image.Width }}"> <meta property="og:image:height" content="{{ $image.Height }}"> diff --git a/layouts/partials/templates/twitter_cards.html b/layouts/partials/templates/twitter_cards.html index f271f5f..ff5412a 100644 --- a/layouts/partials/templates/twitter_cards.html +++ b/layouts/partials/templates/twitter_cards.html @@ -9,12 +9,8 @@ {{- $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png" ) -}} - {{- $image := "" -}} - {{- with .Params.featured_image -}} - {{- $image := .Resources.GetMatch .Params.featured_image -}} - {{- end -}} - - {{- if and .IsPage $image }} + {{- if and .IsPage .Params.featured_image }} + {{- $image := .Resources.GetMatch .Params.featured_image }} <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="{{ $image.Permalink }}"> {{- else }} |
