diff --git a/README.md b/README.md index 93446408..d4f94787 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ I hope you will LoveIt ❤️! * **Gravatar** supported by [Gravatar](https://gravatar.com) * Local **Avatar** supported -* Up to **61** social links supported +* Up to **62** social links supported * Up to **28** share sites supported * **Disqus** comment system supported by [Disqus](https://disqus.com) * **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) diff --git a/README.zh-cn.md b/README.zh-cn.md index 4c9c14b4..a1b295a0 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -77,7 +77,7 @@ * 支持 **[Gravatar](https://gravatar.com)** 头像 * 支持本地**头像** -* 支持多达 **61** 种社交链接 +* 支持多达 **62** 种社交链接 * 支持多达 **28** 种网站分享 * 支持 **[Disqus](https://disqus.com)** 评论系统 * 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统 diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a0d90daa..9347d29b 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -104,6 +104,8 @@ enableEmoji = true searchKey = "b42948e51daaa93df92381c8e2ac0f93" # Home page config [languages.en.params.home] + # amount of RSS pages + rss = 10 # Home page profile [languages.en.params.home.profile] enable = true @@ -190,6 +192,7 @@ enableEmoji = true # XMPP = "xxxx" # Matrix = "xxxx" # Bilibili = "xxxx" + RSS = true [languages.zh-cn] weight = 2 @@ -269,6 +272,8 @@ enableEmoji = true searchKey = "b42948e51daaa93df92381c8e2ac0f93" # 主页信息设置 [languages.zh-cn.params.home] + # RSS 文章数目 + rss = 10 # 主页个人信息 [languages.zh-cn.params.home.profile] enable = true @@ -355,6 +360,7 @@ enableEmoji = true # XMPP = "xxxx@example.com" # Matrix = "xxxx" Bilibili = "xxxx" + RSS = true [languages.fr] weight = 3 @@ -434,6 +440,8 @@ enableEmoji = true searchKey = "b42948e51daaa93df92381c8e2ac0f93" # Home page config [languages.fr.params.home] + # amount of RSS pages + rss = 10 # Home page profile [languages.fr.params.home.profile] enable = true @@ -520,6 +528,7 @@ enableEmoji = true # XMPP = "xxxx" # Matrix = "xxxx" # Bilibili = "xxxx" + RSS = true [params] # LoveIt theme version @@ -583,6 +592,9 @@ enableEmoji = true # date format (month and day) # 日期格式 (月和日) dateFormat = "01-02" + # amount of RSS pages + # RSS 文章数目 + rss = 10 # List (category or tag) page config # List (目录或标签) 页面配置 @@ -593,6 +605,9 @@ enableEmoji = true # date format (month and day) # 日期格式 (月和日) dateFormat = "01-02" + # amount of RSS pages + # RSS 文章数目 + rss = 10 # Page config # 文章页面配置 @@ -903,6 +918,7 @@ enableEmoji = true # 作者配置 [author] name = "xxxx" + email = "" link = "" # Sitemap config diff --git a/exampleSite/content/about.en.md b/exampleSite/content/about.en.md index cddee8f9..29671549 100644 --- a/exampleSite/content/about.en.md +++ b/exampleSite/content/about.en.md @@ -46,7 +46,7 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a * :(far fa-user): **Gravatar** supported by [Gravatar](https://gravatar.com) * :(fas fa-user-circle): Local **Avatar** supported -* :(far fa-id-card): Up to **61** social links supported +* :(far fa-id-card): Up to **62** social links supported * :(fas fa-share-square): Up to **28** share sites supported * :(far fa-comment): **Disqus** comment system supported by [Disqus](https://disqus.com) * :(far fa-comment-dots): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) diff --git a/exampleSite/content/about.fr.md b/exampleSite/content/about.fr.md index eb073860..5e550270 100644 --- a/exampleSite/content/about.fr.md +++ b/exampleSite/content/about.fr.md @@ -51,7 +51,7 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a * :(far fa-user): **Gravatar** supported by [Gravatar](https://gravatar.com) * :(fas fa-user-circle): Local **Avatar** supported -* :(far fa-id-card): Up to **61** social links supported +* :(far fa-id-card): Up to **62** social links supported * :(fas fa-share-square): Up to **28** share sites supported * :(far fa-comment): **Disqus** comment system supported by [Disqus](https://disqus.com) * :(far fa-comment-dots): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) diff --git a/exampleSite/content/about.zh-cn.md b/exampleSite/content/about.zh-cn.md index a18555c2..e2cf691c 100644 --- a/exampleSite/content/about.zh-cn.md +++ b/exampleSite/content/about.zh-cn.md @@ -46,7 +46,7 @@ lightgallery: true * :(far fa-user): 支持 **[Gravatar](https://gravatar.com)** 头像 * :(fas fa-user-circle): 支持本地**头像** -* :(far fa-id-card): 支持多达 **61** 种社交链接 +* :(far fa-id-card): 支持多达 **62** 种社交链接 * :(fas fa-share-square): 支持多达 **28** 种网站分享 * :(far fa-comment): 支持 **[Disqus](https://disqus.com)** 评论系统 * :(far fa-comment-dots): 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统 diff --git a/exampleSite/content/posts/theme-documentation-basics.en.md b/exampleSite/content/posts/theme-documentation-basics.en.md index 4dc5da57..410e4858 100644 --- a/exampleSite/content/posts/theme-documentation-basics.en.md +++ b/exampleSite/content/posts/theme-documentation-basics.en.md @@ -244,6 +244,8 @@ Note that some of these parameters are explained in details in other sections of paginate = 20 # date format (month and day) dateFormat = "01-02" + # amount of RSS pages + rss = 10 # {{< version 0.2.0 >}} List (category or tag) page config [params.list] @@ -251,9 +253,13 @@ Note that some of these parameters are explained in details in other sections of paginate = 20 # date format (month and day) dateFormat = "01-02" + # amount of RSS pages + rss = 10 # Home page config [params.home] + # {{< version 0.2.0 >}} amount of RSS pages + rss = 10 # Home page profile [params.home.profile] enable = true @@ -343,6 +349,7 @@ Note that some of these parameters are explained in details in other sections of # XMPP = "xxxx" # Matrix = "xxxx" # Bilibili = "xxxx" + RSS = true # {{< version 0.2.0 >}} # {{< version 0.2.0 changed >}} Page config [params.page] @@ -606,6 +613,7 @@ Note that some of these parameters are explained in details in other sections of # Author config [author] name = "xxxx" + email = "" link = "" # Sitemap config diff --git a/exampleSite/content/posts/theme-documentation-basics.fr.md b/exampleSite/content/posts/theme-documentation-basics.fr.md index 8fcb6c49..4ce6b893 100644 --- a/exampleSite/content/posts/theme-documentation-basics.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics.fr.md @@ -249,6 +249,8 @@ Note that some of these parameters are explained in details in other sections of paginate = 20 # date format (month and day) dateFormat = "01-02" + # amount of RSS pages + rss = 10 # {{< version 0.2.0 >}} List (category or tag) page config [params.list] @@ -256,9 +258,13 @@ Note that some of these parameters are explained in details in other sections of paginate = 20 # date format (month and day) dateFormat = "01-02" + # amount of RSS pages + rss = 10 # Home page config [params.home] + # {{< version 0.2.0 >}} amount of RSS pages + rss = 10 # Home page profile [params.home.profile] enable = true @@ -348,6 +354,7 @@ Note that some of these parameters are explained in details in other sections of # XMPP = "xxxx" # Matrix = "xxxx" # Bilibili = "xxxx" + RSS = true # {{< version 0.2.0 >}} # {{< version 0.2.0 changed >}} Page config [params.page] @@ -611,6 +618,7 @@ Note that some of these parameters are explained in details in other sections of # Author config [author] name = "xxxx" + email = "" link = "" # Sitemap config diff --git a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md index 18cbb656..17970d20 100644 --- a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md @@ -247,6 +247,8 @@ hugo paginate = 20 # 日期格式 (月和日) dateFormat = "01-02" + # RSS 文章数目 + rss = 10 # {{< version 0.2.0 >}} List (目录或标签) 页面配置 [params.list] @@ -254,9 +256,13 @@ hugo paginate = 20 # 日期格式 (月和日) dateFormat = "01-02" + # RSS 文章数目 + rss = 10 # 主页配置 [params.home] + # {{< version 0.2.0 >}} RSS 文章数目 + rss = 10 # 主页个人信息 [params.home.profile] enable = true @@ -346,6 +352,7 @@ hugo # XMPP = "xxxx" # Matrix = "xxxx" Bilibili = "xxxx" + RSS = true # {{< version 0.2.0 >}} # {{< version 0.2.0 changed >}} 文章页面配置 [params.page] @@ -609,6 +616,7 @@ hugo # 作者配置 [author] name = "xxxx" + email = "" link = "" # 网站地图配置 diff --git a/layouts/rss.xml b/layouts/inde.rss.xml similarity index 58% rename from layouts/rss.xml rename to layouts/inde.rss.xml index b2aa7642..263082b4 100644 --- a/layouts/rss.xml +++ b/layouts/inde.rss.xml @@ -1,13 +1,13 @@ - + - {{- with .Title }}{{ . }} | {{ end }}{{ .Site.Title -}} + {{- .Site.Title -}} {{- .Permalink -}} - {{- with .Title }}{{ . }} | {{ end }}{{ .Site.Title -}} + {{- .Site.Params.description | default .Site.Title -}} Hugo -- gohugo.io {{- with .Site.LanguageCode -}} @@ -17,10 +17,10 @@ {{- end -}} {{- with .Site.Author.email -}} - {{- . }}{{ with .Site.Author.name }} ({{ . }}){{ end -}} + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} - {{- . }}{{ with .Site.Author.name }} ({{ . }}){{ end -}} + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} {{- end -}} {{- with .Site.Copyright -}} @@ -33,8 +33,8 @@ {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} {{- end -}} - - {{- range first 15 (where .Data.Pages "Type" "!=" "home") -}} + + {{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}} {{- .Title -}} @@ -45,16 +45,18 @@ <pubDate> {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} </pubDate> - {{- with .Site.Author.email -}} - <author> - {{- . }}{{ with .Site.Author.name }} ({{ . }}){{ end -}} - </author> - {{- end -}} + <author> + {{- .Params.author | default $.Site.Author.name | default (T "author") -}} + </author> <guid> {{- .Permalink -}} </guid> <description> - {{- .Content | html -}} + {{- with .Summary -}} + {{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}} + {{- else -}} + {{- .Description | plainify -}} + {{- end -}} </description> </item> {{- end -}} diff --git a/layouts/index.atom.xml b/layouts/index.atom.xml deleted file mode 100644 index 6e29f962..00000000 --- a/layouts/index.atom.xml +++ /dev/null @@ -1,45 +0,0 @@ -<feed xmlns="http://www.w3.org/2005/Atom"> - {{- with .Title }}{{ . }} | {{ end }}{{ .Site.Title -}} - <link href="{{ .Permalink }}index.xml" rel="self"/> - <link href="{{ .Permalink }}"/> - {{- if not .Date.IsZero -}} - <updated> - {{- .Date.Format "02-01-2006T15:04:05-07:00" -}} - </updated> - {{- end -}} - <id> - {{- .Permalink -}} - </id> - <author> - {{- with .Site.Author.name -}} - <name>{{ . }}</name> - {{- end -}} - {{- with .Site.Author.email -}} - <email>{{ . }}</email> - {{- end -}} - </author> - <generator>Hugo -- gohugo.io</generator> - {{- range first 15 (where .Data.Pages "Type" "in" .Site.Params.mainSections) -}} - <entry> - <title type="html"><![CDATA[{{ .Title -}}]]> - - - {{- .Permalink -}} - - {{- with .Site.Author.name -}} - - - {{- . -}} - - - {{- end -}} - - {{- .Date.Format "2006-01-02T15:04:05-07:00" -}} - - - {{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}} - - - - {{- end -}} - diff --git a/layouts/partials/plugin/link.html b/layouts/partials/plugin/link.html index ec9aa102..443bcf00 100644 --- a/layouts/partials/plugin/link.html +++ b/layouts/partials/plugin/link.html @@ -1,5 +1,5 @@ {{- $rel := "" -}} - + {{- with .icon -}} {{- partial "plugin/icon.html" . -}} {{- end -}} diff --git a/layouts/partials/plugin/script.html b/layouts/partials/plugin/script.html index f5ba9cb0..45a72ca2 100644 --- a/layouts/partials/plugin/script.html +++ b/layouts/partials/plugin/script.html @@ -3,7 +3,7 @@ {{- else -}} {{- $src := .source -}} {{- $integrity := .integrity -}} - {{- if strings.HasPrefix $src "http" | or (strings.HasPrefix $src "//") | not -}} + {{- if (urls.Parse $src).Host | not -}} {{- $res := resources.Get $src -}} {{- with .template -}} {{- $res = $res | resources.ExecuteAsTemplate . $.context -}} diff --git a/layouts/partials/plugin/social.html b/layouts/partials/plugin/social.html index c88a39ad..6f05c359 100644 --- a/layouts/partials/plugin/social.html +++ b/layouts/partials/plugin/social.html @@ -427,6 +427,13 @@ {{- partial "plugin/link.html" $options -}} {{- end -}} + {{- /* 062: RSS */ -}} + {{- if .social.rss -}} + {{- $options := dict "href" (relLangURL "/index.xml") "title" "RSS" "newtab" true "rel" "me" -}} + {{- $options = dict "icon" (dict "class" "fas fa-rss fa-fw") | merge $options -}} + {{- partial "plugin/link.html" $options -}} + {{- end -}} + {{- /* Custom */ -}} {{- with .social.Custom -}} {{- . | safeHTML -}} diff --git a/layouts/partials/plugin/stylesheet.html b/layouts/partials/plugin/stylesheet.html index 0a4dac3f..54d057a2 100644 --- a/layouts/partials/plugin/stylesheet.html +++ b/layouts/partials/plugin/stylesheet.html @@ -3,7 +3,7 @@ {{- else -}} {{- $href := .source -}} {{- $integrity := .integrity -}} - {{- if strings.HasPrefix $href "http" | not -}} + {{- if (urls.Parse $href).Host | not -}} {{- $res := resources.Get $href -}} {{- with .template -}} {{- $res = $res | resources.ExecuteAsTemplate . $.context -}} diff --git a/layouts/posts/rss.xml b/layouts/posts/rss.xml new file mode 100644 index 00000000..49aba415 --- /dev/null +++ b/layouts/posts/rss.xml @@ -0,0 +1,64 @@ + + + + {{- T .Section | default .Section | printf (T "allSome") }} | {{ .Site.Title -}} + + + {{- .Permalink -}} + + + {{- T .Section | default .Section | printf (T "allSome") }} | {{ .Site.Title -}} + + Hugo -- gohugo.io + {{- with .Site.LanguageCode -}} + + {{- . -}} + + {{- end -}} + {{- with .Site.Author.email -}} + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + {{- end -}} + {{- with .Site.Copyright -}} + + {{- . -}} + + {{- end -}} + {{- if not .Date.IsZero -}} + + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + {{- end -}} + + {{- range .Pages | first (.Site.Params.section.rss | default 10) -}} + + + {{- .Title -}} + + + {{- .Permalink -}} + + + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + + {{- .Params.author | default $.Site.Author.name | default (T "author") -}} + + + {{- .Permalink -}} + + + {{- with .Summary -}} + {{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}} + {{- else -}} + {{- .Description | plainify -}} + {{- end -}} + + + {{- end -}} + + diff --git a/layouts/shortcodes/music.html b/layouts/shortcodes/music.html index 09339149..b0e3edeb 100644 --- a/layouts/shortcodes/music.html +++ b/layouts/shortcodes/music.html @@ -34,7 +34,7 @@ {{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}} > {{- end -}} -{{- else if strings.HasSuffix (.Get 0) "http" -}} +{{- else if (.Get 0 | urls.Parse).Host -}} {{- else -}} diff --git a/layouts/taxonomy/rss.xml b/layouts/taxonomy/rss.xml new file mode 100644 index 00000000..4f9bed6d --- /dev/null +++ b/layouts/taxonomy/rss.xml @@ -0,0 +1,64 @@ + + + + {{- .Title }} | {{ T .Data.Singular | default (humanize .Data.Singular) }} | {{ .Site.Title -}} + + + {{- .Permalink -}} + + + {{- .Title }} | {{ T .Data.Singular | default (humanize .Data.Singular) }} | {{ .Site.Title -}} + + Hugo -- gohugo.io + {{- with .Site.LanguageCode -}} + + {{- . -}} + + {{- end -}} + {{- with .Site.Author.email -}} + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + {{- end -}} + {{- with .Site.Copyright -}} + + {{- . -}} + + {{- end -}} + {{- if not .Date.IsZero -}} + + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + {{- end -}} + + {{- range .Pages | first (.Site.Params.list.rss | default 10) -}} + + + {{- .Title -}} + + + {{- .Permalink -}} + + + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + + {{- .Params.author | default $.Site.Author.name | default (T "author") -}} + + + {{- .Permalink -}} + + + {{- with .Summary -}} + {{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}} + {{- else -}} + {{- .Description | plainify -}} + {{- end -}} + + + {{- end -}} + +