diff options
| -rw-r--r-- | layouts/_default/list.atom.xml | 2 | ||||
| -rw-r--r-- | layouts/_default/list.feed.xml | 4 | ||||
| -rw-r--r-- | layouts/_default/list.html.html (renamed from layouts/_default/list.html) | 4 | ||||
| -rw-r--r-- | layouts/_default/list.json.json | 2 | ||||
| -rw-r--r-- | layouts/partials/head.html | 2 | ||||
| -rw-r--r-- | layouts/partials/title.html | 5 |
6 files changed, 11 insertions, 8 deletions
diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index f82bb8b..dc14748 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -15,7 +15,7 @@ {{- safeHTML "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" }} <feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="{{ site.LanguageCode }}"> - {{ printf `<title type="html"><![CDATA[%s]]></title>` site.Title | safeHTML }} + {{ printf `<title type="html"><![CDATA[%s]]></title>` (partial "title.html" .) | safeHTML }} {{ with site.Params.description }}{{ printf `<subtitle type="html"><![CDATA[%s]]></subtitle>` . | safeHTML }}{{ end }} {{- $output_formats := .OutputFormats }} {{- range $output_formats -}} diff --git a/layouts/_default/list.feed.xml b/layouts/_default/list.feed.xml index 5a276ec..c55b19b 100644 --- a/layouts/_default/list.feed.xml +++ b/layouts/_default/list.feed.xml @@ -24,13 +24,13 @@ xmlns:media="http://search.yahoo.com/mrss/" xml:lang="{{ site.LanguageCode }}"> <channel> - {{ printf `<title type="html"><![CDATA[%s RSS 2.0]]></title>` site.Title | safeHTML }} + {{ printf `<title type="html"><![CDATA[%s]]></title>` (partial "title.html" .) | safeHTML }} </channel> <link type="text/html">{{ site.BaseURL | absURL }}</link> {{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png") }}{{ $logo = $logo.Resize "96x96" }} <image> <url>{{ $logo.Permalink | absURL }}</url> - {{ printf `<title type="html"><![CDATA[%s RSS 2.0]]></title>` site.Title | safeHTML }} + {{ printf `<title type="html"><![CDATA[%s]]></title>` (partial "title.html" .) | safeHTML }} <link>{{ site.BaseURL | absURL }}</link> <width>{{ $logo.Width }}</width> <height>{{ $logo.Height }}</height> diff --git a/layouts/_default/list.html b/layouts/_default/list.html.html index 3a1d953..13f2947 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html.html @@ -1,8 +1,6 @@ {{ define "main" }} <div class="articles"> - {{- with .Title }} - <h1 class="page-title">{{ . }}</h1> - {{- end }} + {{ with .Title }}<h1 class="page-title">{{ . }}</h1>{{ end }} {{- with .Content }} <div class="category-content"> {{ .Content }} diff --git a/layouts/_default/list.json.json b/layouts/_default/list.json.json index 6151211..bfcb852 100644 --- a/layouts/_default/list.json.json +++ b/layouts/_default/list.json.json @@ -15,7 +15,7 @@ { "version": "https://jsonfeed.org/version/1.1", - "title": {{ (printf "%s JSON Feed" site.Title) | htmlUnescape | jsonify }}, + "title": {{ (printf "%s" (partial "title.html" .)) | htmlUnescape | jsonify }},{{/* TODO: Translate title */}} "home_page_url": {{ printf "%s?utm_source=json_feed" site.BaseURL | absURL | jsonify }}, {{ with .OutputFormats.Get "JSON" }}"feed_url": {{ .Permalink | absURL | jsonify }},{{ end }} {{ with site.Params.description}}"description": {{ site.Params.description | jsonify }},{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 44bc202..3ef34e2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -5,7 +5,7 @@ <link rel="canonical" href="{{ .Permalink }}"> - <title>{{ block "title" . }}{{ if .IsHome }}{{ site.Title }}{{ else }}{{ with .Params.Title }}{{ . }} - {{ end }}{{ site.Title }}{{ end }}{{ end }}</title> + <title>{{ block "title" . }}{{- partial "title.html" . -}}{{ end }}</title> <meta name="description" content="{{ (partial "description.html" . ) }}"> <meta name="author" content="{{ (partial "author.html" . ) }}"> {{ hugo.Generator }} diff --git a/layouts/partials/title.html b/layouts/partials/title.html new file mode 100644 index 0000000..a767901 --- /dev/null +++ b/layouts/partials/title.html @@ -0,0 +1,5 @@ +{{- if .IsHome -}} + {{- site.Title -}} +{{- else -}} + {{- with .Title }}{{ . }} - {{ end }}{{ site.Title -}} +{{- end -}} |
