diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-17 09:15:01 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-17 09:15:21 +0200 |
| commit | 94f67e5829a7239ced73c3f18072a761a4ced176 (patch) | |
| tree | 2a31a3467855eef58eedeffcf775a7de0b655cfa | |
| parent | 4f466a4fefb1ea97b37bd2d11c03d50871b5b002 (diff) | |
| download | gohugo-theme-ed-94f67e5829a7239ced73c3f18072a761a4ced176.tar.gz | |
Escaped some stuff in atom feed
| -rw-r--r-- | exampleSite/config.toml | 2 | ||||
| -rw-r--r-- | layouts/_default/home.atom.xml | 18 |
2 files changed, 8 insertions, 12 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a8e3eee..403f574 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -34,7 +34,7 @@ disableKinds = ['RSS'] # application/atom+xml. However, Chromium does not handle it # correctly (see https://code.google.com/p/chromium/issues/detail?id=104358). # - # The most compatible header is text/xml;charset=UTF-8, which + # The most compatible header is 'text/xml; charset=utf-8', which # will cause the feed to be parsed correctly by most clients. # Note that you should be encoding your feed in UTF-8. mediaType = 'text/xml' diff --git a/layouts/_default/home.atom.xml b/layouts/_default/home.atom.xml index b1befc0..ff6cda4 100644 --- a/layouts/_default/home.atom.xml +++ b/layouts/_default/home.atom.xml @@ -3,14 +3,14 @@ xmlns:media="http://search.yahoo.com/mrss/" xml:lang="{{ site.LanguageCode }}" xml:base="{{site.BaseURL }}"> - <title>{{ site.Title }}</title> - {{ with site.Params.description }}<subtitle>{{ . }}</subtitle>{{ end }} + <title>{{ printf "<![CDATA[%s]]>" site.Title | safeHTML }}</title> + {{ with site.Params.description }}<subtitle type="html">{{ printf "<![CDATA[%s]]>" . | safeHTML }}</subtitle>{{ end }} {{ with site.Home.OutputFormats.Get "Atom" }}<link href="{{ .RelPermalink }}" rel="self" type="{{ .MediaType.Type | html }}" />{{ end }} {{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png" ) }}{{ $logo = $logo.Resize "96x96" }}<icon>{{$logo.RelPermalink}}</icon> <logo>{{$logo.RelPermalink}}</logo> {{ with site.Author.name }}<author> - <name>{{.}}</name> - {{ with site.Author.email }}<email>{{.}}</email>{{end}} + <name>{{ printf "<![CDATA[%s]]>" . | safeHTML }}</name> + {{ with site.Author.email }}<email>{{ . }}</email>{{end}} </author>{{end}} {{ with site.Params.Copyright }}<rights type="text">{{ .}}</rights>{{end}} <generator uri="https://gohugo.io" version="{{ hugo.Version }}">Hugo</generator> @@ -21,9 +21,7 @@ <entry> {{- $url := .RelPermalink }}{{ $uuid := sha1 (.Permalink | absURL)}}{{ $page := .}} <category term="{{ .Section}}" /> - {{ range (.GetTerms "tags") }} - <category term="{{ .LinkTitle }}" /> - {{ end }} + {{ range (.GetTerms "tags") }}<category term="{{ .LinkTitle }}" />{{ end }} <link rel="alternate" type="type/html" href="{{ $url }}" /> <title type="text">{{ .Title | plainify}}</title> <published>{{ (.PublishDate.Format site.Params.dateFormatFeed) | html }}</published> @@ -43,10 +41,8 @@ {{ end }} {{- end }} {{ end }} - <summary type="xhtml"> - <div xmlns="http://www.w3.org/1999/xhtml"> - <p>{{ replaceRE "\n" " " (.Summary | plainify | safeHTML | chomp) }}</p> - </div> + <summary type="html"> + {{ printf "<![CDATA[%s]]>" .Summary | safeHTML }} </summary> </entry> {{- end }} |
