Исправлен иногда пустой мета-тег description

This commit is contained in:
MultiMote 2023-11-23 22:01:53 +03:00
parent 595d001191
commit cb8aae6fea
3 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,8 @@
{{ define "head_meta" }}
<meta name="description" content="Страница не найдена">
<meta property="og:description" content="Страница не найдена">
{{end}}
{{ define "main" }} {{ define "main" }}
<div class="single post"> <div class="single post">

View File

@ -2,8 +2,8 @@
<meta property="og:type" content="article"> <meta property="og:type" content="article">
<meta property="og:title" content="{{ .Title }}"> <meta property="og:title" content="{{ .Title }}">
<meta name="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" /> <meta name="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if and (.IsPage) (.Summary) }}{{ .Summary }}{{ else }}{{ .Title }}{{ end }}{{ end }}">
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if and (.IsPage) (.Summary) }}{{ .Summary }}{{ else }}{{ .Title }}{{ end }}{{ end }}">
<meta property="og:url" content="{{ .Permalink }}"> <meta property="og:url" content="{{ .Permalink }}">
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format "2006-01-02T15:04:05-07:00" | printf "content=%q" | safeHTMLAttr }}>{{ end }} {{ with .PublishDate }}<meta property="article:published_time" {{ .Format "2006-01-02T15:04:05-07:00" | printf "content=%q" | safeHTMLAttr }}>{{ end }}
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format "2006-01-02T15:04:05-07:00" | printf "content=%q" | safeHTMLAttr }}>{{ end }} {{ with .Lastmod }}<meta property="article:modified_time" {{ .Format "2006-01-02T15:04:05-07:00" | printf "content=%q" | safeHTMLAttr }}>{{ end }}

View File

@ -1,3 +1,8 @@
{{ define "head_meta" }}
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}Категория {{.Title}}{{ end }}">
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}Категория {{.Title}}{{ end }}">
{{end}}
{{ define "main" }} {{ define "main" }}
<div class="page-wrapper"> <div class="page-wrapper">
<div class="content-column"> <div class="content-column">