0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-14 02:24:00 +01:00
Bootstrap/site/layouts/partials/social.html
Louis-Maxime Piton c5d55771dc From Twitter to X
2024-08-07 12:41:52 +02:00

28 lines
1.3 KiB
HTML

{{- $pageTitle := .Title | markdownify -}}
{{- $pageDescription := .Page.Params.description | default .Site.Params.description | markdownify -}}
{{- $socialImagePath := urls.JoinPath "/docs" .Site.Params.docs_version "assets" -}}
{{- if .Page.Params.thumbnail -}}
{{- $socialImagePath = urls.JoinPath $socialImagePath "img" .Page.Params.thumbnail -}}
{{- else -}}
{{- $socialImagePath = urls.JoinPath $socialImagePath "brand/bootstrap-social.png" -}}
{{- end -}}
<meta name="x:card" content="summary_large_image">
<meta name="x:site" content="@{{ .Site.Params.x }}">
<meta name="x:creator" content="@{{ .Site.Params.x }}">
<meta name="x:title" content="{{ $pageTitle }}">
<meta name="x:description" content="{{ $pageDescription }}">
<meta name="x:image" content="{{ $socialImagePath | absURL }}">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:title" content="{{ $pageTitle }}">
<meta property="og:description" content="{{ $pageDescription }}">
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
<meta property="og:image" content="{{ $socialImagePath | absURL }}">
<meta property="og:image:type" content="image/png">
{{ with (imageConfig (path.Join "site/static" $socialImagePath)) -}}
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
{{- end }}