Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion themes/hugo-graphite/layouts/_default/rss.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
{{- $content := replaceRE "a href=\"(#.*?)\"" (printf "%s%s%s" "a href=\"" .Permalink "$1\"") .Content -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use a comment here to link back to that blog post that explains how this works?

It's unfortunate that hugo doesn't provide something built in for this case, because the regexp approach is going to be fragile (i.e. it relies on the alt attribute coming after the src attribute).

{{- $content = replaceRE "img src=\"(.*?)\"" (printf "%s%s%s" "img src=\"" .Permalink "$1\"") $content -}}
<description>{{ $content | html }}</description>
</item>
{{ end }}
</channel>
Expand Down