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" . }}
<div class="post-content">
{{ partial "opengraph.html" . }}
{{ if .Params.showFullContent }}
{{ .Content }}
{{ else if .Description }}

View file

@ -1,6 +1,5 @@
{{ define "main" }}
<main>
{{ partial "opengraph.html" . }}
<article>
<header>
@ -9,7 +8,7 @@
</h1>
</header>
{{ partial "cover.html" . }}
{{ .TableOfContents }}
{{ .Content | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" `${1}<a href="#${2}" class="hanchor" ariaLabel="Anchor">&#8983;</a> ${3}` | safeHTML }}

View file

@ -43,33 +43,7 @@
{{ end }}
<!-- OG data -->
<meta property="og:locale" content="{{ $.Site.Language.Lang }}" />
<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 }}
{{ partial "opengraph.html" .}}
<!-- RSS -->
{{ with .OutputFormats.Get "RSS" }}

View file

@ -35,10 +35,18 @@
<meta property="og:type" content="website">
{{- end }}
{{- with partial "_funcs/get-page-images" . }}
{{- range . | first 6 }}
<meta property="og:image" content="{{ .Cover | absURL }}">
{{- end }}
{{ 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 }}
{{- with .Params.audio }}