fix: rss image path incorrect: data-src -> src

This commit is contained in:
henry.chen
2022-11-20 23:33:10 +08:00
parent aa91997c0c
commit 4bfff2e5e9
2 changed files with 7 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ func init() {
TplFuncMap["join"] = Join
TplFuncMap["isnotzero"] = IsNotZero
TplFuncMap["getavatar"] = GetAvatar
TplFuncMap["imgtonormal"] = ImgToNormal
}
// Str2html string to html
@@ -73,3 +74,8 @@ func GetAvatar(domain string) string {
return avatar
}
// ImgToNormal replace lazy image attr data-src to src
func ImgToNormal(content string) string {
return strings.ReplaceAll(content, "data-src=", "src=")
}

View File

@@ -15,7 +15,7 @@
<comments>https://{{$.Host}}/post/{{.Slug}}.html#comments</comments>
<guid>https://{{$.Host}}/post/{{.Slug}}.html</guid>
<description>
<![CDATA[{{.Content}}<p>本文链接:<a href="https://{{$.Host}}/post/{{.Slug}}.html">https://{{$.Host}}/post/{{.Slug}}.html</a><a href="https://{{$.Host}}/post/{{.Slug}}.html#comments">参与评论 »</a></p>]]>
<![CDATA[{{imgtonormal .Content}}<p>本文链接:<a href="https://{{$.Host}}/post/{{.Slug}}.html">https://{{$.Host}}/post/{{.Slug}}.html</a><a href="https://{{$.Host}}/post/{{.Slug}}.html#comments">参与评论 »</a></p>]]>
</description>
<pubDate>{{dateformat .CreatedAt "Mon, 02 Jan 2006 15:04:05 -0700"}}</pubDate>
</item>