mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-21 12:40:39 +00:00
use title partial when possible (#190)
This commit is contained in:
parent
91f44eb3a5
commit
1b3e25abc3
@ -2,10 +2,8 @@
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"{{ with .Site.Language.Lang }} xml:lang="{{ . }}"{{ end }}>
|
||||
<generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator>
|
||||
{{- $title := .Site.Title -}}
|
||||
{{- with .Title -}}
|
||||
{{- if (not (eq . $title)) -}}
|
||||
{{- $title = printf `%s on %s` . $title -}}
|
||||
{{- end -}}
|
||||
{{- if not (eq .Kind "home") -}}
|
||||
{{- $title = printf `%s on %s` (partial "utils/title" .) $title -}}
|
||||
{{- end -}}
|
||||
{{ printf `<title type="html"><![CDATA[%s]]></title>` $title | safeHTML }}
|
||||
{{ with .Site.Params.subtitle }}
|
||||
@ -37,7 +35,7 @@
|
||||
{{- range $pages }}
|
||||
{{ $page := . }}
|
||||
<entry>
|
||||
{{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}
|
||||
{{ printf `<title type="html"><![CDATA[%s]]></title>` (partial "utils/title" .) | safeHTML }}
|
||||
<link href="{{ .Permalink }}?utm_source=atom_feed" rel="alternate" type="text/html" {{ with .Site.Language.Lang }} hreflang="{{ . }}"{{ end }} />
|
||||
<id>{{ .Permalink }}</id>
|
||||
{{ with .Params.authors -}}
|
||||
|
@ -1,8 +1,6 @@
|
||||
{{- $title := .Site.Title -}}
|
||||
{{- with .Title -}}
|
||||
{{- if (not (eq . $title)) -}}
|
||||
{{- $title = printf `%s on %s` . $title -}}
|
||||
{{- end -}}
|
||||
{{- if not (eq .Kind "home") -}}
|
||||
{{- $title = printf `%s on %s` (partial "utils/title" .) $title -}}
|
||||
{{- end -}}
|
||||
{
|
||||
"version": "https://jsonfeed.org/version/1.1",
|
||||
@ -33,7 +31,7 @@
|
||||
{{- $len := (len $pages) }}
|
||||
{{- range $i, $page := $pages }}
|
||||
{
|
||||
"title" : {{ .Title | jsonify }},
|
||||
"title" : {{ (partial "utils/title" .) | jsonify }},
|
||||
"date_published" : {{ (.Date.Format "2006-01-02T15:04:05Z07:00") | jsonify }},
|
||||
"date_modified" : {{ (.Lastmod.Format "2006-01-02T15:04:05Z07:00") | jsonify }},
|
||||
"id" : "{{ .Permalink }}",
|
||||
|
@ -66,12 +66,16 @@
|
||||
media="all"
|
||||
/>
|
||||
|
||||
{{ with .OutputFormats.Get "atom" }}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end }}
|
||||
{{- with (.Site.GetPage "home").OutputFormats.Get "atom" }}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s Atom Feed">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{- end }}
|
||||
|
||||
{{ if (default false $.Site.Params.GeekblogOverwriteHTMLBase) }}
|
||||
{{- with (.Site.GetPage "home").OutputFormats.Get "json" }}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s JSON Feed">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{- end }}
|
||||
|
||||
{{- if (default false $.Site.Params.GeekblogOverwriteHTMLBase) }}
|
||||
<base href="{{ .Site.BaseURL }}" />
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{ printf "<!-- %s -->" "Made with Geekblog theme https://github.com/thegeeklab/hugo-geekblog" | safeHTML }}
|
||||
|
@ -29,8 +29,8 @@
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"articleSection": "{{ .Section }}",
|
||||
"name": "{{ .Title | safeJS }}",
|
||||
"headline": "{{ .Title | safeJS }}",
|
||||
"name": "{{ (partial "utils/title" .) | safeJS }}",
|
||||
"headline": "{{ (partial "utils/title" .) | safeJS }}",
|
||||
{{- with .Params.lead }}
|
||||
"alternativeHeadline": "{{ . }}",
|
||||
{{- end }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<meta property="og:title" content="{{ .Title }}" />
|
||||
<meta property="og:title" content="{{ partial "utils/title" . }}" />
|
||||
{{ with partial "utils/description" . }}
|
||||
<meta property="og:description" content="{{ trim (. | plainify) "\n" }}" />
|
||||
{{ end }}
|
||||
|
@ -17,7 +17,7 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
<meta name="twitter:title" content="{{ .Title }}" />
|
||||
<meta name="twitter:title" content="{{ partial "utils/title" . }}" />
|
||||
{{- with partial "utils/description" . }}
|
||||
<meta name="twitter:description" content="{{ trim (. | plainify) "\n" }}" />
|
||||
{{- end }}
|
||||
|
@ -53,7 +53,7 @@
|
||||
class="gblog-nav__entry {{ if eq $currentPage .RelPermalink }}is-active{{ end }}"
|
||||
href="{{ .RelPermalink }}"
|
||||
>
|
||||
{{ .Title }}
|
||||
{{ partial "utils/title" . }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user