hugo-theme-lowtech/layouts/partials/social_metadata.html

70 lines
3.3 KiB
HTML

{{/* https://github.com/msfjarvis/hugo-social-metadata */}}
{{ if .Site.Params.FaviconEmoji }}
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{ .Site.Params.FaviconEmoji }}</text></svg>">
{{ else if .Site.Params.FaviconSVG }}
<link rel="icon" href="data:image/svg+xml;{{ safeURL .Site.Params.FaviconSVG }}">
{{ else if .Site.Params.FaviconFile }}
<link rel="icon" href="{{ .Site.Params.FaviconFile }}">
{{ end }}
<!-- Configure meta and title tags -->
<meta property="og:type" content="website" />
{{ if .Site.Params.TwitterCardType }}
<meta name="twitter:card" content="{{ .Site.Params.TwitterCardType }}" />
{{ else }}
<meta name="twitter:card" content="summary_large_image" />
{{ end }}
{{ if .Site.Params.TwitterUsername }}
<meta name="twitter:site" content="{{ .Site.Params.TwitterUsername }}" />
{{ end }}
{{ if .IsHome }}
<title>{{ default .Site.Title .Title }}</title>
<meta name="description" content="{{ default $.Site.Params.description .Description }}" />
<meta property="og:image" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" />
<meta property="og:url" content="{{ .Site.BaseURL }}" />
<meta property="og:title" content="{{ default .Site.Title .Title }}" />
<meta name="og:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:title" content="{{ default .Site.Title .Title }}" />
<meta name="twitter:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:url" content="{{ .Site.BaseURL }}" />
<meta name="twitter:image:src" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" />
{{ else }}
<title>{{ .Title }} &middot; {{ .Site.Title }}</title>
<meta name="description" content="{{ .Description }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:title" content="{{ .Title }} &middot; {{ .Site.Title }}" />
<meta name="twitter:title" content="{{ .Title }} &middot; {{ .Site.Title }}" />
{{ if .Description }}
<meta name="og:description" content="{{ .Description }}" />
<meta name="twitter:description" content="{{ .Description }}" />
{{ else }}
<meta name="og:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:description" content="{{ $.Site.Params.description }}" />
{{ end }}
<meta name="twitter:url" content="{{ .Permalink }}" />
{{ if .Params.SocialImage }}
<meta name="twitter:image:src" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" />
{{ else }}
<meta name="twitter:image:src" content="{{ .Site.Params.SocialImage }}" />
{{ end }}
{{ end }}
{{ if .Params.tags }}
<meta name="keywords" content="{{ range .Params.tags }}{{ . }},{{ end }}" />
{{ else if .Keywords }}
<meta name="keywords" content="{{ range .Keywords }}{{ . }},{{ end }}" />
{{ else }}
<meta name="keywords" content="{{ $.Site.Params.Keywords }}" />
{{ end }}
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "WebSite",
"name": "{{ default .site.Title .Title }}",
"image": "{{ .Site.Params.SocialImage }}",
"about": "{{ $.Site.Params.description }}"
}
</script>