fix social card thumbnail for HLTB entries
This commit is contained in:
parent
0f97c6c78d
commit
1fd758e97e
|
@ -2,9 +2,9 @@
|
|||
{{ $base := .Site.BaseURL }}
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
{{ if .Title }}
|
||||
{{- if .Title }}
|
||||
<title>{{ .Title }} | {{ .Site.Title }}</title>
|
||||
{{ else }}
|
||||
{{- else }}
|
||||
<title>{{ .Site.Title }}</title>
|
||||
{{ end }}
|
||||
<meta content="{{ .Title }} | {{ .Site.Title }}" property="og:title">
|
||||
|
@ -17,61 +17,56 @@
|
|||
<link rel="author" href="{{ $base }}humans.txt" type="text/plain" />
|
||||
<link rel="webmention" href="https://jam.brainbaking.com/webmention" />
|
||||
<link rel="pingback" href="https://jam.brainbaking.com/pingback" />
|
||||
|
||||
{{ if .Description }}
|
||||
{{- if .Description }}
|
||||
<meta name="description" content="{{ .Title }}. {{ .Description | safeHTML }} Via {{ .Site.Title }}">
|
||||
<meta content="{{ .Title }}. {{ .Description | safeHTML }} Via {{ .Site.Title }}" property="og:description">
|
||||
{{ else }}
|
||||
{{- else }}
|
||||
<meta name="description" content="{{ .Title }}. {{ .Summary | safeHTML }}">
|
||||
<meta content="{{ .Title }}. {{ .Summary | safeHTML }} Via {{ .Site.Title }}" property="og:description">
|
||||
{{ end }}
|
||||
|
||||
{{ if .Keywords }}
|
||||
{{- if .Keywords }}
|
||||
<meta content="{{ delimit .Keywords ", " }}, {{ .Title }}" name="keywords">
|
||||
{{ else if .Params.tags }}
|
||||
{{- else if .Params.tags }}
|
||||
<meta content="{{ delimit .Params.tags ", " }}, {{ .Title }}" name="keywords">
|
||||
{{ end }}
|
||||
|
||||
<!-- opengraph meta -->
|
||||
<!-- see https://github.com/nozzle/hugo-snippets/blob/master/layouts/partials/head/seo/open_graph.html -->
|
||||
|
||||
<meta property="og:url" content="{{ $perm }}" />
|
||||
<meta property="og:type" content="{{ if .Params.type }}{{ .Params.type }}{{ else }}website{{ end }}" />
|
||||
{{ $thumb := "img/favicon.png" | absURL }}
|
||||
{{ if .Params.image }}
|
||||
{{ $thumb = .Params.image | absURL }}
|
||||
{{ else if .Params.howlongtobeat_id }}
|
||||
{{ $thumb = printf "%s%d%s" "img/hltb/" .Params.howlongtobeat_id ".jpg" | absURL }}
|
||||
{{ else }}
|
||||
{{ $match := findRE `!\[(.*)\]\((.+).(jpg|png|gif)` .RawContent 1 }}
|
||||
{{ range $match }}
|
||||
{{ $relthumb := replaceRE `!\[(.*)\]\(` "" . }}
|
||||
{{ if hasPrefix $relthumb "/" }}
|
||||
{{ $thumb = printf "%s%s" $base $relthumb }}
|
||||
{{ else }}
|
||||
{{ $thumb = printf "%s%s" $perm $relthumb }}
|
||||
{{- $thumb := "img/favicon.png" | absURL }}
|
||||
{{- if .Params.image }}
|
||||
{{- $thumb = .Params.image | absURL }}
|
||||
{{- else if .Params.howlongtobeat_id }}
|
||||
{{- $thumb = printf "%s%s" $perm "cover.jpg" | absURL }}
|
||||
{{- else }}
|
||||
{{- $match := findRE `!\[(.*)\]\((.+).(jpg|png|gif)` .RawContent 1 }}
|
||||
{{- range $match }}
|
||||
{{- $relthumb := replaceRE `!\[(.*)\]\(` "" . }}
|
||||
{{- if hasPrefix $relthumb "/" }}
|
||||
{{- $thumb = printf "%s%s" $base $relthumb }}
|
||||
{{- else }}
|
||||
{{- $thumb = printf "%s%s" $perm $relthumb }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<meta property="og:image" content="{{ $thumb }}" />
|
||||
<!-- zie sidebar.html, zelfde logica gebruikt -->
|
||||
{{ $related := first 3 (where (where (where .Site.Pages.ByDate.Reverse ".Type" "==" "articles") ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" $perm) }}
|
||||
{{- $related := first 3 (where (where (where .Site.Pages.ByDate.Reverse ".Type" "==" "articles") ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" $perm) }}
|
||||
|
||||
{{ if $related }}
|
||||
{{ range $related }}
|
||||
{{- if $related }}
|
||||
{{- range $related }}
|
||||
<meta property="og:see_also" content="{{ $perm }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<meta property="article:published_time" content="{{ .PublishDate }}" />
|
||||
<meta property="article:modified_time" content="{{ .Date }}" />
|
||||
<meta property="article:section" content="{{ .Section }}" />
|
||||
{{ with .Params.tags }}{{ range first 6 . }}
|
||||
{{- with .Params.tags }}{{ range first 6 . }}
|
||||
<meta property="article:tag" content="{{ . }}" />
|
||||
{{ end }}{{ end }}
|
||||
<!-- end og -->
|
||||
|
||||
<!-- structured data -->
|
||||
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context" : "http://schema.org",
|
||||
|
|
Loading…
Reference in New Issue