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

70 lines
3.4 KiB
HTML
Raw Permalink Normal View History

2020-03-09 15:08:09 +01:00
{{/* https://github.com/msfjarvis/hugo-social-metadata */}}
2021-07-01 15:29:20 +02:00
{{ 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 }}
2020-03-09 15:08:09 +01:00
<!-- 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 }}
2021-04-21 00:36:39 +02:00
<title>{{ default .Site.Title .Title }}</title>
<meta name="description" content="{{ default $.Site.Params.description .Description }}" />
2020-03-09 15:08:09 +01:00
<meta property="og:image" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" />
<meta property="og:url" content="{{ .Site.BaseURL }}" />
2021-04-21 00:36:39 +02:00
<meta property="og:title" content="{{ default .Site.Title .Title }}" />
2020-03-09 15:08:09 +01:00
<meta name="og:description" content="{{ $.Site.Params.description }}" />
2021-04-21 00:36:39 +02:00
<meta name="twitter:title" content="{{ default .Site.Title .Title }}" />
2020-03-09 15:08:09 +01:00
<meta name="twitter:description" content="{{ $.Site.Params.description }}" />
<meta name="twitter:url" content="{{ .Site.BaseURL }}" />
2022-02-16 12:50:05 +01:00
<meta name="twitter:image" content="{{ .Site.BaseURL}}{{ .Site.Params.SocialImage }}" />
2020-03-09 15:08:09 +01:00
{{ else }}
2021-04-21 00:34:49 +02:00
<title>{{ .Title }} &middot; {{ .Site.Title }}</title>
2020-03-09 15:08:09 +01:00
<meta name="description" content="{{ .Description }}" />
2020-03-09 15:08:09 +01:00
<meta property="og:url" content="{{ .Permalink }}" />
2021-04-21 00:34:49 +02:00
<meta property="og:title" content="{{ .Title }} &middot; {{ .Site.Title }}" />
<meta name="twitter:title" content="{{ .Title }} &middot; {{ .Site.Title }}" />
2020-03-09 15:08:09 +01:00
{{ 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 }}
2022-02-16 12:50:05 +01:00
<meta name="twitter:image" content="{{ .Site.BaseURL }}{{ .Params.SocialImage }}" />
2020-03-09 15:08:09 +01:00
{{ else }}
2022-02-16 12:50:05 +01:00
<meta name="twitter:image" content="{{ .Site.BaseURL }}{{ .Site.Params.SocialImage }}" />
2020-03-09 15:08:09 +01:00
{{ 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 }}
2022-02-15 10:09:08 +01:00
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "WebSite",
2022-02-16 12:58:24 +01:00
"name": "{{ default .Site.Title .Title }}",
2022-02-16 12:50:05 +01:00
"image": "{{ .Site.BaseURL}}{{ default .Site.Params.SocialImage .Params.SocialImage }}",
"about": "{{ .Site.Params.description }}"
2022-02-15 10:09:08 +01:00
}
</script>