Improve formating of generated code

This commit is contained in:
Serghei Iakovlev 2022-07-12 23:51:05 +02:00
parent 4217561a5e
commit cad2f67c2f
No known key found for this signature in database
GPG key ID: C6AF1016BBDEA800
4 changed files with 21 additions and 23 deletions
layouts/partials

View file

@ -23,18 +23,18 @@
{{- range .AllTranslations -}}
<link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}">
{{ end -}}
{{- end }}
<meta name="theme-color" content="#ffffff">
{{ block "custom-head" . }}{{ partial "custom-head.html" . }}{{ end }}
{{ block "custom-scripts" . }}{{ partial "custom-scripts.html" . }}{{ end }}
{{- block "custom-head" . }}{{ partial "custom-head.html" . }}{{ end }}
{{- block "custom-scripts" . }}{{ partial "custom-scripts.html" . }}{{ end }}
{{- /* Misc */}}
{{ template "partials/templates/opengraph.html" . }}
{{ template "partials/templates/twitter_cards.html" . }}
{{ template "partials/templates/schema_json.html" . }}
{{- template "partials/templates/opengraph.html" . }}
{{- template "partials/templates/twitter_cards.html" . }}
{{- template "partials/templates/schema_json.html" . }}
{{- /* SEO */}}
{{ partial "partials/seo/ga.html" . }}
{{- partial "partials/seo/ga.html" . }}
</head>

View file

@ -1,14 +1,14 @@
{{- /* Get schema type. */}}
{{ $schemaType := "Article" }}
{{ if or (eq .Type "post") (eq .Type "posts") }}
{{ $schemaType = "BlogPosting" }}
{{ end -}}
{{- $schemaType := "Article" -}}
{{- if or (eq .Type "post") (eq .Type "posts") -}}
{{- $schemaType = "BlogPosting" -}}
{{- end -}}
{{- $publisher := site.Params.seo.publisher | default site.Title }}
{{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") }}
{{ $logo = $logo.Resize "96x96" -}}
{{- $publisher := site.Params.seo.publisher | default site.Title -}}
{{- $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") -}}
{{- $logo = $logo.Resize "96x96" }}
<script type="application/ld+json">
<script type="application/ld+json" id="schema-data">
{
"@context": "https://schema.org",
"@type": {{ $schemaType }},
@ -62,5 +62,3 @@
"description": {{ partial "description.html" . }}
}
</script>

View file

@ -1,4 +1,4 @@
<script type="application/ld+json">
<script type="application/ld+json" id="schema-data">
{
"@context": "https://schema.org",
"@type": "WebSite",

View file

@ -10,10 +10,10 @@
{{- $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png" ) -}}
{{- if and .IsPage .Params.featured_image }}
{{- $image := .Resources.GetMatch .Params.featured_image }}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ $image.Permalink }}">
{{- $image := .Resources.GetMatch .Params.featured_image }}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ $image.Permalink }}">
{{- else }}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ $logo.Permalink }}">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ $logo.Permalink }}">
{{- end -}}