Skip to content

Commit 8626305

Browse files
jmooringadityatelange
authored andcommitted
[PATCH] tpl/tplimpl: Remove trailing slash from void elements
cherry-picked from gohugoio/hugo@2f7df4b
1 parent 65bd711 commit 8626305

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed
+16-16
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
<meta property="og:title" content="{{ .Title }}" />
2-
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
3-
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
4-
<meta property="og:url" content="{{ .Permalink }}" />
1+
<meta property="og:title" content="{{ .Title }}">
2+
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
3+
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
4+
<meta property="og:url" content="{{ .Permalink }}">
55
{{- if .Params.cover.image -}}
66
{{- if (ne .Params.cover.relative true) }}
7-
<meta property="og:image" content="{{ .Params.cover.image | absURL }}" />
7+
<meta property="og:image" content="{{ .Params.cover.image | absURL }}">
88
{{- else}}
9-
<meta property="og:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
9+
<meta property="og:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}">
1010
{{- end}}
1111
{{- else }}
1212

1313
{{- $images := partial "partials/templates/_funcs/get-page-images" . -}}
1414
{{- range first 6 $images }}
15-
<meta property="og:image" content="{{ .Permalink }}" />
15+
<meta property="og:image" content="{{ .Permalink }}">
1616
{{ end -}}
1717
{{- end }}
1818

1919
{{- if .IsPage }}
2020
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
21-
<meta property="article:section" content="{{ .Section }}" />
22-
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
23-
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
21+
<meta property="article:section" content="{{ .Section }}">
22+
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>{{ end }}
23+
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>{{ end }}
2424
{{- end -}}
2525

26-
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
27-
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
28-
{{- with site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
26+
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}">{{ end }}
27+
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}">{{ end }}
28+
{{- with site.Params.title }}<meta property="og:site_name" content="{{ . }}">{{ end }}
2929
{{- with .Params.videos }}{{- range . }}
30-
<meta property="og:video" content="{{ . | absURL }}" />
30+
<meta property="og:video" content="{{ . | absURL }}">
3131
{{ end }}{{ end }}
3232

3333
{{- /* If it is part of a series, link to related articles */}}
@@ -37,7 +37,7 @@
3737
{{ with .Params.series }}{{- range $name := . }}
3838
{{- $series := index $siteSeries ($name | urlize) }}
3939
{{- range $page := first 6 $series.Pages }}
40-
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
40+
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}">{{ end }}
4141
{{- end }}
4242
{{ end }}{{ end }}
4343
{{- end }}
@@ -46,7 +46,7 @@
4646
{{- with site.Params.social }}
4747
{{- if reflect.IsMap . }}
4848
{{- with .facebook_admin }}
49-
<meta property="fb:admins" content="{{ . }}" />
49+
<meta property="fb:admins" content="{{ . }}">
5050
{{- end }}
5151
{{- end }}
5252
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{{- if .Params.cover.image -}}
2-
<meta name="twitter:card" content="summary_large_image" />
2+
<meta name="twitter:card" content="summary_large_image">
33
{{- if (ne $.Params.cover.relative true) }}
4-
<meta name="twitter:image" content="{{ .Params.cover.image | absURL }}" />
4+
<meta name="twitter:image" content="{{ .Params.cover.image | absURL }}">
55
{{- else }}
6-
<meta name="twitter:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
6+
<meta name="twitter:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}">
77
{{- end}}
88
{{- else }}
99
{{- $images := partial "partials/templates/_funcs/get-page-images" . -}}
1010
{{- with index $images 0 -}}
11-
<meta name="twitter:card" content="summary_large_image" />
12-
<meta name="twitter:image" content="{{ .Permalink }}" />
11+
<meta name="twitter:card" content="summary_large_image">
12+
<meta name="twitter:image" content="{{ .Permalink }}">
1313
{{- else -}}
14-
<meta name="twitter:card" content="summary"/>
14+
<meta name="twitter:card" content="summary">
1515
{{- end -}}
1616
{{- end }}
17-
<meta name="twitter:title" content="{{ .Title }}"/>
18-
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
17+
<meta name="twitter:title" content="{{ .Title }}">
18+
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}">
1919

2020
{{- $twitterSite := "" }}
2121
{{- with site.Params.social }}
@@ -25,7 +25,7 @@
2525
{{- if not (strings.HasPrefix . "@") }}
2626
{{- $content = printf "@%v" . }}
2727
{{- end }}
28-
<meta name="twitter:site" content="{{ $content }}"/>
28+
<meta name="twitter:site" content="{{ $content }}">
2929
{{- end }}
3030
{{- end }}
3131
{{- end }}

0 commit comments

Comments
 (0)