blog/themes/hugo-blog-awesome/layouts/partials/meta/post.html

62 lines
2.3 KiB
HTML

{{/* These meta tags are rendered only in the posts section (i.e. in single/list page) */}}
{{ if eq .Section "posts" }}
{{ $ISO_date := dateFormat "2006-01-02T15:04:05Z0700" .Date | safeHTML }}
<!-- Pagination meta tags for list pages only -->
{{ if ne .Page.Kind "page" }}
{{ $paginator := .Paginate (where .Pages "Section" "blog") }}
{{ if $paginator }}
<link rel="first" href="{{ $paginator.First.URL }}" />
<link rel="last" href="{{ $paginator.Last.URL }}" />
{{ if $paginator.HasPrev }}
<link rel="prev" href="{{ $paginator.Prev.URL }}" />
{{end }}
{{ if $paginator.HasNext }}
<link rel="next" href="{{ $paginator.Next.URL }}" />
{{end }}
{{end }}
{{end }}
<meta property="og:type" content="article" />
<meta property="og:article:published_time" content={{ $ISO_date | safeHTML }} />
<meta property="article:published_time" content={{ $ISO_date | safeHTML }} />
<meta property="og:url" content="{{ .Permalink }}" />
{{ with.Site.Params.author }}
<meta property="og:article:author" content="{{ .name }}" />
<meta property="article:author" content="{{ .name }}" />
<meta name="author" content="{{ .name }}" />
{{ with.fediverseAccount }}
<meta name="fediverse:creator" content="{{ . }}" />{{/* ref https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/ */}}
{{ end }}
{{ end }}
{{ with.Params.category }}
<meta name="news_keywords" content="{{ index . 0 }}" />
<meta property="article:section" content="{{ index . 0 }}" />
{{ end }}
<script defer type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"headline": {{ .Title }},
"author": {
"@type": "Person",
"name": "{{ .Site.Params.github }}"
},
"datePublished": "{{ dateFormat "2006-01-02" .Date }}",
"description": {{ .Description }},
"wordCount": {{ .WordCount }},
"mainEntityOfPage": "True",
"dateModified": "{{ dateFormat "2006-01-02" .Lastmod }}",
"image": {
"@type": "imageObject",
"url": "{{ with .Params.image }}{{ . | absURL }}{{ end }}"
},
"publisher": {
"@type": "Organization",
"name": "{{ .Site.Title }}"
}
}
</script>
{{ end }}