feat: add social link for RSS and some configs (#250)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||
<channel>
|
||||
<title>
|
||||
{{- with .Title }}{{ . }} | {{ end }}{{ .Site.Title -}}
|
||||
{{- .Site.Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<description>
|
||||
{{- with .Title }}{{ . }} | {{ end }}{{ .Site.Title -}}
|
||||
{{- .Site.Params.description | default .Site.Title -}}
|
||||
</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
{{- with .Site.LanguageCode -}}
|
||||
@@ -17,10 +17,10 @@
|
||||
{{- end -}}
|
||||
{{- with .Site.Author.email -}}
|
||||
<managingEditor>
|
||||
{{- . }}{{ with .Site.Author.name }} ({{ . }}){{ end -}}
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</managingEditor>
|
||||
<webMaster>
|
||||
{{- . }}{{ with .Site.Author.name }} ({{ . }}){{ end -}}
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</webMaster>
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
@@ -33,8 +33,8 @@
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</lastBuildDate>
|
||||
{{- end -}}
|
||||
<atom:link href="{{.Permalink}}" rel="self" type="application/rss+xml" />
|
||||
{{- range first 15 (where .Data.Pages "Type" "!=" "home") -}}
|
||||
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
|
||||
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
|
||||
<item>
|
||||
<title>
|
||||
{{- .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 -}}
|
||||
@@ -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 -}}]]></title>
|
||||
<link href="{{ .Permalink }}"/>
|
||||
<id>
|
||||
{{- .Permalink -}}
|
||||
</id>
|
||||
{{- with .Site.Author.name -}}
|
||||
<author>
|
||||
<name>
|
||||
{{- . -}}
|
||||
</name>
|
||||
</author>
|
||||
{{- end -}}
|
||||
<published>
|
||||
{{- .Date.Format "2006-01-02T15:04:05-07:00" -}}
|
||||
</published>
|
||||
<updated>
|
||||
{{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}}
|
||||
</updated>
|
||||
<content type="html"><![CDATA[{{- .Content -}}]]></content>
|
||||
</entry>
|
||||
{{- end -}}
|
||||
</feed>
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $rel := "" -}}
|
||||
<a href="{{ .href }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .href "http" }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .rel }} {{ . }}{{ end }}"{{ with .class }} class="{{ . }}"{{ end }}>
|
||||
<a href="{{ .href }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .href).Host | or .newtab }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .rel }} {{ . }}{{ end }}"{{ with .class }} class="{{ . }}"{{ end }}>
|
||||
{{- with .icon -}}
|
||||
{{- partial "plugin/icon.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
64
layouts/posts/rss.xml
Normal file
64
layouts/posts/rss.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||
<channel>
|
||||
<title>
|
||||
{{- T .Section | default .Section | printf (T "allSome") }} | {{ .Site.Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<description>
|
||||
{{- T .Section | default .Section | printf (T "allSome") }} | {{ .Site.Title -}}
|
||||
</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
{{- with .Site.LanguageCode -}}
|
||||
<language>
|
||||
{{- . -}}
|
||||
</language>
|
||||
{{- end -}}
|
||||
{{- with .Site.Author.email -}}
|
||||
<managingEditor>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</managingEditor>
|
||||
<webMaster>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</webMaster>
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
<copyright>
|
||||
{{- . -}}
|
||||
</copyright>
|
||||
{{- end -}}
|
||||
{{- if not .Date.IsZero -}}
|
||||
<lastBuildDate>
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</lastBuildDate>
|
||||
{{- end -}}
|
||||
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
|
||||
{{- range .Pages | first (.Site.Params.section.rss | default 10) -}}
|
||||
<item>
|
||||
<title>
|
||||
{{- .Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<pubDate>
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</pubDate>
|
||||
<author>
|
||||
{{- .Params.author | default $.Site.Author.name | default (T "author") -}}
|
||||
</author>
|
||||
<guid>
|
||||
{{- .Permalink -}}
|
||||
</guid>
|
||||
<description>
|
||||
{{- with .Summary -}}
|
||||
{{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}}
|
||||
{{- else -}}
|
||||
{{- .Description | plainify -}}
|
||||
{{- end -}}
|
||||
</description>
|
||||
</item>
|
||||
{{- end -}}
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -34,7 +34,7 @@
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- end -}}
|
||||
{{- else if strings.HasSuffix (.Get 0) "http" -}}
|
||||
{{- else if (.Get 0 | urls.Parse).Host -}}
|
||||
<meting-js auto="{{ .Get 0 }}" theme="{{ $theme }}"></meting-js>
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="{{ $theme }}"></meting-js>
|
||||
|
||||
64
layouts/taxonomy/rss.xml
Normal file
64
layouts/taxonomy/rss.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||
<channel>
|
||||
<title>
|
||||
{{- .Title }} | {{ T .Data.Singular | default (humanize .Data.Singular) }} | {{ .Site.Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<description>
|
||||
{{- .Title }} | {{ T .Data.Singular | default (humanize .Data.Singular) }} | {{ .Site.Title -}}
|
||||
</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
{{- with .Site.LanguageCode -}}
|
||||
<language>
|
||||
{{- . -}}
|
||||
</language>
|
||||
{{- end -}}
|
||||
{{- with .Site.Author.email -}}
|
||||
<managingEditor>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</managingEditor>
|
||||
<webMaster>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</webMaster>
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
<copyright>
|
||||
{{- . -}}
|
||||
</copyright>
|
||||
{{- end -}}
|
||||
{{- if not .Date.IsZero -}}
|
||||
<lastBuildDate>
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</lastBuildDate>
|
||||
{{- end -}}
|
||||
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
|
||||
{{- range .Pages | first (.Site.Params.list.rss | default 10) -}}
|
||||
<item>
|
||||
<title>
|
||||
{{- .Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<pubDate>
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</pubDate>
|
||||
<author>
|
||||
{{- .Params.author | default $.Site.Author.name | default (T "author") -}}
|
||||
</author>
|
||||
<guid>
|
||||
{{- .Permalink -}}
|
||||
</guid>
|
||||
<description>
|
||||
{{- with .Summary -}}
|
||||
{{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}}
|
||||
{{- else -}}
|
||||
{{- .Description | plainify -}}
|
||||
{{- end -}}
|
||||
</description>
|
||||
</item>
|
||||
{{- end -}}
|
||||
</channel>
|
||||
</rss>
|
||||
Reference in New Issue
Block a user