diff options
author | Eddie Webbinaro <ollitech@gmail.com> | 2022-05-15 20:38:25 +0300 |
---|---|---|
committer | Eddie Webbinaro <ollitech@gmail.com> | 2022-05-15 20:38:25 +0300 |
commit | df6fd5c1fe185a6c0b8ca204f424dc0c172a235e (patch) | |
tree | b1a81c373204b088f03501608bbb38a6d38a92ca | |
parent | 37734c92008a6ed1f93110c225a43ca885f86f6e (diff) |
allow page to override og title meta
-rw-r--r-- | layouts/_default/baseof.html | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 762adc7..15a0287 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,14 +4,16 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>{{ .Site.Title }} | {{ .Title }}</title> - <meta property="og:title" content="{{ .Site.Title }} | {{ .Title }}" /> + <meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{else}}{{ .Description }}{{ end }}"> - {{if isset .Params "featured_image" }} - <meta property="og:image" content="{{ index .Params "featured_image" }}" /> + {{ $preview_image := .Resources.GetMatch "site_preview" }} + {{if $preview_image }} + <meta property="og:image" content="{{ $preview_image.Permalink }}" /> + <meta property="og:title" content="{{ $preview_image.Title }}" /> {{ else }} <meta property="og:image" content="{{ .Site.Params.profileImage | absURL }}" /> + <meta property="og:title" content="{{ .Site.Title }} | {{ .Title }}" /> {{ end }} - <meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{else}}{{ .Description }}{{ end }}"> <meta property="og:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{else}}{{ .Description }}{{ end }}" /> <meta name="author" content="{{ .Site.Params.firstName }} {{ .Site.Params.lastName }}"> <!-- Bootstrap core CSS --> |