Skip to content

Commit 91e7767

Browse files
committed
fix: Fix deprecated warnings for language params
Fix site params and format rss.xml. Command used to search and replace site params. ```bash sed -i "s/site\.Copyright/site\.Params.Copyright/" layouts/**/*.html ```
1 parent f1de322 commit 91e7767

File tree

3 files changed

+42
-23
lines changed

3 files changed

+42
-23
lines changed

exampleSite/config/_default/config.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
baseurl = "https://manid2.github.io/hugo-xterm/"
1+
title = "Hugo Xterm"
22
languageCode = "en-us"
3+
baseurl = "https://manid2.github.io/hugo-xterm/"
34
paginate = 20
45
canonifyurls = true
56

@@ -21,14 +22,9 @@ canonifyurls = true
2122
creator = "mani_d2"
2223

2324
[languages]
24-
[languages.en]
25-
title = "Hugo Xterm"
25+
[languages.en.params]
2626
copyright = "© Mani Kumar"
27-
menuMore = "Show more"
28-
readMore = "Read more"
2927
readOtherPosts = "Read other posts"
30-
newerPosts = "Previous"
31-
olderPosts = "Next"
3228
missingContentMessage = "Page not found..."
3329
missingBackButtonLabel = "Back to home page"
3430

layouts/_default/rss.xml

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,63 @@
11
{{- $pctx := . -}}
2-
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
2+
{{- if .IsHome -}}
3+
{{ $pctx = .Site }}
4+
{{- end -}}
5+
36
{{- $pages := slice -}}
47
{{- if or $.IsHome $.IsSection -}}
5-
{{- $pages = $pctx.RegularPages -}}
8+
{{- $pages = $pctx.RegularPages -}}
69
{{- else -}}
7-
{{- $pages = $pctx.Pages -}}
10+
{{- $pages = $pctx.Pages -}}
811
{{- end -}}
12+
913
{{- $limit := .Site.Config.Services.RSS.Limit -}}
1014
{{- if ge $limit 1 -}}
11-
{{- $pages = $pages | first $limit -}}
15+
{{- $pages = $pages | first $limit -}}
1216
{{- end -}}
17+
1318
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
1419
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
1520
<channel>
1621
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
1722
<link>{{ .Permalink }}</link>
1823
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
19-
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
20-
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
21-
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
22-
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
23-
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
24-
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
24+
<generator>Hugo -- gohugo.io</generator>
25+
26+
{{- with .Site.LanguageCode }}
27+
<language>{{.}}</language>
28+
{{- end }}
29+
30+
{{- with .Site.Author.email }}
31+
<managingEditor>{{.}}{{with $.Site.Author.name}} ({{.}}){{end}}</managingEditor>
32+
<webMaster>{{.}}{{with $.Site.Author.name}} ({{.}}){{end}}</webMaster>
33+
{{- end}}
34+
35+
{{- with .Site.Params.Copyright }}
36+
<copyright>{{.}}</copyright>
37+
{{- end}}
38+
39+
{{- if not .Date.IsZero }}
40+
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
41+
{{- end }}
42+
2543
{{- with .OutputFormats.Get "RSS" -}}
26-
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
44+
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
2745
{{- end -}}
28-
{{ range $pages }}
46+
47+
{{- range $pages }}
2948
<item>
3049
<title>{{ .Title }}</title>
3150
<link>{{ .Permalink }}</link>
3251
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
33-
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
52+
53+
{{- with .Site.Author.email }}
54+
<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>
55+
{{- end}}
56+
3457
<guid>{{ .Permalink }}</guid>
3558
<description>{{ .Summary | html }}</description>
3659
<content>{{ .Content | html }}</content>
3760
</item>
38-
{{ end }}
61+
{{- end }}
3962
</channel>
4063
</rss>

layouts/partials/footer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
{{- /* site copyright */}}
2424
<div class="copyright">
2525
<p>
26-
{{- if site.Copyright -}}
27-
{{ site.Copyright | safeHTML }}
26+
{{- if site.Params.Copyright -}}
27+
{{ site.Params.Copyright | safeHTML }}
2828
{{ now.Year }}
2929
{{- end -}}
3030

0 commit comments

Comments
 (0)