Merge pull request #7 from kumitterer/main

fix: ensure default image for og and twitter cards
This commit is contained in:
rottenwheel 2024-11-09 18:53:17 +00:00 committed by GitHub
commit 67d21f427d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,13 +8,21 @@
{{ $css := $style | minify | fingerprint }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
{{ $image := "" }}
{{ if .Params.image }}
{{ $image = .Params.image }}
{{ else }}
{{ $image = resources.Get "images/rw_profile.jpg" }}
{{ end }}
<meta property="og:title" content="{{ .Title }}">
<meta property="og:description" content="{{ .Description }}">
<meta property="og:type" content="article">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:image" content="{{ .Site.BaseURL }}{{ .Params.image }}">
<meta property="og:image" content="{{ .Site.BaseURL }}{{ $image }}">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ .Title }}">
<meta name="twitter:description" content="{{ .Description }}">
<meta name="twitter:image" content="{{ .Site.BaseURL }}{{ .Params.image }}">
<meta name="twitter:image" content="{{ .Site.BaseURL }}{{ $image }}">
</head>