diff options
author | Chad Tindel <chad@tindel.net> | 2022-02-22 18:40:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 18:40:48 +0300 |
commit | 1b5f1c9418f74341979524f000347a3ccfafa1ff (patch) | |
tree | 9cbc134bef9b6261b72b5fc3542ee28df813942c | |
parent | d36be1a5301f1c2a223519315fdfbfc438847f3a (diff) |
Add option to disable title case in RSS XML file (#370)
-rw-r--r-- | REFERENCE.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/section/episode.rss.xml | 24 |
3 files changed, 17 insertions, 9 deletions
diff --git a/REFERENCE.md b/REFERENCE.md index 721492c..5451a60 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -47,6 +47,7 @@ These should be set under the `[params]` section: | `episode_number_prefix` | No | A prefix used in the episode's RSS feed before the episode number. For example, if episode_number_prefix was set to CWC for episode 1, then the output might be Title of the Episode - CWC1. | "CWC" | | `site_layout` | No | The layout for the home page. The options are `row` (default) or `grid`. | "grid" | | `enable_jumbo` | No | When using the `row` layout, will set a jumbotron at the top instead of the sidebar. | "true" | +| `disable_title_caps` | No | When generating the RSS XML file do not convert the episode title to Title Case (using Title Case is the default) | "false" | | `show_next_upcoming` | No | If there are episodes with the upcoming frontmatter set to true, then it will display the next episode on homepage. This halves the screen real estate of the latest episode section, which will then be displayed side by side. | "true" | | `truncate` | No | The number of characters to truncate the summary on the row layout. This can be overridden per-episode as well. The default value (if not set) is 600 characters. | "700" | | `custom_css` | No | Array of custom CSS files for over-riding theme settings or adding your own classes. These files should be put into your `static` directory (not the `static` directory of the theme). | ["custom.css", "other_custom.css"] | diff --git a/exampleSite/config.toml b/exampleSite/config.toml index de92fea..b05c2c5 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -81,6 +81,7 @@ site_layout = "row" show_next_upcoming = "true" enable_jumbo = "true" # enable_jumbo = "false" +disable_title_caps = "true" # truncate = "100" # about_logo = "/img/hugocast.png" copyright_notice = "Copyright 2016 [Matt Stratton](https://www.mattstrattion.io)" diff --git a/layouts/section/episode.rss.xml b/layouts/section/episode.rss.xml index f0766cf..9dac31e 100644 --- a/layouts/section/episode.rss.xml +++ b/layouts/section/episode.rss.xml @@ -52,20 +52,22 @@ <generator>Hugo -- gohugo.io</generator> {{- range (where ( where .Site.Pages "Type" "episode") ".Params.upcoming" "!=" true) -}} {{ if isset .Params "podcast_file" }} - <item> + <item> + {{ if and (isset .Site.Params "disable_title_caps") (eq .Site.Params.disable_title_caps "true") }} + <title>{{ .Title }} + {{ else }} + <title>{{ title .Title }} + {{ end }} {{ if and (isset .Site.Params "episode_number_style") (.Params.episode) }} {{ if eq .Site.Params.episode_number_style "parens" }} - <title>{{ title .Title }} ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})</title> + ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}) {{ else if eq .Site.Params.episode_number_style "brackets" }} - <title>{{ title .Title }} [{{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}]</title> + [{{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}] {{ else if eq .Site.Params.episode_number_style "dash" }} - <title>{{ title .Title }} - {{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}</title> - {{ else }} - <title>{{ title .Title }}</title> + - {{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }} {{ end }} - {{ else }} - <title>{{ title .Title }}</title> {{ end }} + </title> <link>{{ .Permalink }}</link> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} </pubDate> <dc:creator>{{ .Site.Params.itunes_author }}</dc:creator> @@ -98,7 +100,11 @@ {{ with .Params.episode }} <itunes:episode>{{ . }}</itunes:episode> {{ end }} - <itunes:title>{{ title .Title }}</itunes:title> + {{ if and (isset .Site.Params "disable_title_caps") (eq .Site.Params.disable_title_caps "true") }} + <itunes:title>{{ .Title }}</itunes:title> + {{ else }} + <itunes:title>{{ title .Title }}</itunes:title> + {{ end }} {{"<itunes:subtitle><![CDATA[" | safeHTML }} {{ with .Params.subtitle }} {{ . | plainify | truncate 243 "..." }} |