Opengraph опять
All checks were successful
/ site (push) Successful in 1s

This commit is contained in:
Артём 2024-08-10 11:08:26 +03:00
parent 7400d68fd3
commit 498073d201
Signed by: SadmL
GPG key ID: EEFBB39006B28920
4 changed files with 14 additions and 34 deletions

View file

@ -39,7 +39,6 @@
{{ partial "cover.html" . }} {{ partial "cover.html" . }}
<div class="post-content"> <div class="post-content">
{{ partial "opengraph.html" . }}
{{ if .Params.showFullContent }} {{ if .Params.showFullContent }}
{{ .Content }} {{ .Content }}
{{ else if .Description }} {{ else if .Description }}

View file

@ -1,6 +1,5 @@
{{ define "main" }} {{ define "main" }}
<main> <main>
{{ partial "opengraph.html" . }}
<article> <article>
<header> <header>

View file

@ -43,33 +43,7 @@
{{ end }} {{ end }}
<!-- OG data --> <!-- OG data -->
<meta property="og:locale" content="{{ $.Site.Language.Lang }}" /> {{ partial "opengraph.html" .}}
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:title" content="{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }}{{ end }}">
<meta property="og:description" content="{{ if .IsHome }}{{ $.Site.Params.Subtitle }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ $.Site.Title }}" />
{{ if (isset .Params "cover") }}
{{ $pageCover := .Param "cover" }}
{{ with (.Resources.GetMatch (.Param "cover")) }}
{{ $pageCover = .RelPermalink }}
{{ end }}
<meta property="og:image" content="{{ $pageCover | absURL }}">
{{ else }}
{{ if isset $.Site.Params "favicon" }}
<meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}">
{{ else }}
<meta property="og:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}">
{{ end }}
{{ end }}
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="627">
{{ range .Params.categories }}
<meta property="article:section" content="{{ . }}" />
{{ end }}
{{ if isset .Params "date" }}
<meta property="article:published_time" content="{{ time .Date }}" />
{{ end }}
<!-- RSS --> <!-- RSS -->
{{ with .OutputFormats.Get "RSS" }} {{ with .OutputFormats.Get "RSS" }}

View file

@ -35,10 +35,18 @@
<meta property="og:type" content="website"> <meta property="og:type" content="website">
{{- end }} {{- end }}
{{- with partial "_funcs/get-page-images" . }} {{ if (isset .Params "cover") }}
{{- range . | first 6 }} {{ $pageCover := .Param "cover" }}
<meta property="og:image" content="{{ .Cover | absURL }}"> {{ with (.Resources.GetMatch (.Param "cover")) }}
{{- end }} {{ $pageCover = .RelPermalink }}
{{ end }}
<meta property="og:image" content="{{ $pageCover | absURL }}">
{{ else }}
{{ if isset $.Site.Params "favicon" }}
<meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}">
{{ else }}
<meta property="og:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}">
{{ end }}
{{- end }} {{- end }}
{{- with .Params.audio }} {{- with .Params.audio }}