Skip to content

Commit 7c80cab

Browse files
authored
Make RSS feed contain full content in html (#2530)
1 parent f6eeb7f commit 7c80cab

File tree

8 files changed

+61
-2
lines changed

8 files changed

+61
-2
lines changed

Diff for: layouts/_default/rss.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
5555
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
5656
<guid>{{ .Permalink }}</guid>
57-
<description>{{ .Description | transform.XMLEscape | safeHTML }}</description>
5857
{{ if .Params.Images }}<media:content
5958
xmlns:media="http://search.yahoo.com/mrss/"
6059
url="{{ (index (.Params.Images) 0) | absURL | safeHTML }}"
6160
medium="image"
6261
type="image/jpeg"
6362
/>{{ end }}
63+
<description>{{ .Content | transform.XMLEscape | safeHTML }}</description>
6464
</item>{{- end }}
6565
{{- end }}
6666
{{- if eq .Title "Changelog" }}

Diff for: layouts/partials/card.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{ $customTitle := .customTitle }}
2+
{{ $customDescription := .customDescription }}
3+
{{ $customCanonicalLink := .customCanonicalLink }}
4+
{{ $link := (path.Clean (.link)) }}
5+
{{ with site.GetPage $link }}
6+
<li>{{if $customCanonicalLink }}<a href="{{ $customCanonicalLink }}">{{ else }} <a href="{{.RelPermalink}}"> {{ end }}{{ if $customTitle }} {{ $customTitle }} {{ else }} {{ .Title }} {{ end }}</a>: {{ if $customDescription }} {{ $customDescription }} {{ else }} {{ .Description }} {{ end }}</li>
7+
{{ end }}

Diff for: layouts/shortcodes/card.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ partial "card.xml" (dict "link" (.Get "link") "class" (.Get "class") "customTitle" (.Get "customTitle") "customDescription" (.Get "customDescription") "customCanonicalLink" (.Get "canonical") "imageOverwrite" (.Get "imageOverwrite") ) }}

Diff for: layouts/shortcodes/cards.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<ul>{{- .Inner -}}</ul>

Diff for: layouts/shortcodes/changelog.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<link>https://docs.viam.com/appendix/changelog/#{{ .Get "title" | anchorize }}</link>
44
<pubDate>{{ .Get "date" | time.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</pubDate>
55
<guid>https://docs.viam.com/appendix/changelog/#{{ .Get "title" | anchorize }}</guid>
6-
<description>{{ .Inner | markdownify | plainify | transform.XMLEscape }}</description>
6+
<description>{{ .Inner | markdownify | transform.XMLEscape | safeHTML }}</description>
77
</item>

Diff for: layouts/shortcodes/gif.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div>
2+
<video autoplay loop muted playsinline alt="{{ .Get "alt" }}" width="100%" style="max-width: {{ .Get "max-width" }}" class="{{- if .Get "class" -}}{{ .Get "class" }}{{- end }}">
3+
<source src="{{relURL (substr (.Get "webm_src") 1) }}" type="video/webm">
4+
<source src="{{relURL (substr (.Get "mp4_src") 1) }}" type="video/mp4">
5+
</video>
6+
</div>

Diff for: layouts/shortcodes/tabs.xml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{{- .Page.Scratch.Add "tabset-counter" 1 -}}
2+
{{- $tab_set_id := .Get "name" | default (printf "tabset-%s-%d" (.Page.RelPermalink) (.Page.Scratch.Get "tabset-counter") ) | anchorize -}}
3+
{{- $tabs := .Scratch.Get "tabs" -}}
4+
{{- if .Inner -}}{{- /* We don't use the inner content, but Hugo will complain if we don't reference it. */ -}}{{- end -}}
5+
<div class="table">
6+
{{- range $i, $e := $tabs -}}
7+
{{- $id := printf "%s-%d" $tab_set_id $i -}}
8+
{{- if (eq $i 0) -}}
9+
<h4>{{- trim .name " " -}}:</h4>
10+
<div class="tab-content" id="tab-content-{{ $tab_set_id }}">
11+
<div id="{{ $id }}" class="tab-pane show active" role="tabpanel" aria-labelledby="{{ $id }}">
12+
{{ else }}
13+
<h4>{{- trim .name " " -}}:</h4>
14+
<div id="{{ $id }}" class="tab-pane" role="tabpanel" aria-labelledby="{{ $id }}">
15+
{{ end }}
16+
{{- with .content -}}
17+
{{- . -}}
18+
{{- else -}}
19+
{{- if eq $.Page.BundleType "leaf" -}}
20+
{{- /* find the file somewhere inside the bundle. Note the use of double asterisk */ -}}
21+
{{- with $.Page.Resources.GetMatch (printf "**%s*" .include) -}}
22+
{{- if ne .ResourceType "page" -}}
23+
{{- /* Assume it is a file that needs code highlighting. */ -}}
24+
{{- $codelang := $e.codelang | default ( path.Ext .Name | strings.TrimPrefix ".") -}}
25+
{{- highlight .Content $codelang "" -}}
26+
{{- else -}}
27+
{{- .Content -}}
28+
{{- end -}}
29+
{{- end -}}
30+
{{- else -}}
31+
{{- $path := path.Join $.Page.File.Dir .include -}}
32+
{{- $page := site.GetPage "page" $path -}}
33+
{{- with $page -}}
34+
{{- .Content -}}
35+
{{- else -}}
36+
{{- errorf "[%s] tabs include not found for path %q" site.Language.Lang $path -}}
37+
{{- end -}}
38+
{{- end -}}
39+
{{- end -}}
40+
</div>
41+
</div>
42+
{{- end -}}
43+
</div>

Diff for: layouts/shortcodes/youtube.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>In the full post there is a video here. You can see it <a href="{{ .Get "embed_url" }}">on Youtube</a>.</p>

0 commit comments

Comments
 (0)