diff --git a/README.md b/README.md index 707ad5d..9950fc8 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,8 @@ __Sites using hermit-V2__ is a user contributed list of all the blogs/pages that You can find currently listed sites from [Sites-using-hermitā€V2 (https://github.com/1bl4z3r/hermit-V2/wiki#sites-using-hermit-v2)](https://github.com/1bl4z3r/hermit-V2/wiki#sites-using-hermit-v2) and you can add your site by raising an [issue](https://github.com/1bl4z3r/hermit-V2/issues/new?assignees=1bl4z3r&labels=hermit-V2+sites&projects=&template=add-remove-sites-using-hermit-v2.md&title=Add+to+Sites+using+hermit-V2). +## To-Do +- [ ] Add support for [Speculation Rules API](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API#browser_compatibility) when it is stable ## Share your thoughts Share your thoughts on how to make this theme more suited for you. It could be a general feedback or something that couldn't be classified as an Issue. You can share it in Discussions : [https://github.com/1bl4z3r/hermit-V2/discussions](https://github.com/1bl4z3r/hermit-V2/discussions) diff --git a/content/posts/post-with-featured-image.md b/content/posts/post-with-featured-image.md index c42ff5c..62ce598 100644 --- a/content/posts/post-with-featured-image.md +++ b/content/posts/post-with-featured-image.md @@ -3,7 +3,9 @@ title: "Post With Featured Image" date: 2018-10-01T16:15:09+08:00 draft: false images: - - https://picsum.photos/1024/768/?random + - https://picsum.photos/seed/picsum/1024/768 + - images/928-600x400.jpg +featuredImg: "images/928-600x400.jpg" tags: - Demo - Image diff --git a/hugo.toml b/hugo.toml index 70b437b..90af093 100644 --- a/hugo.toml +++ b/hugo.toml @@ -3,16 +3,16 @@ defaultContentLanguage = "en" defaultContentLanguageInSubdir = true enableRobotsTXT = true +enableEmoji = true + # [outputs] -# home = ['html', 'rss'] -# page = ['html'] +# home = ['html'] +# page = ['html', 'rss'] # rss = ['rss'] # section = ['html', 'rss'] # taxonomy = ['html', 'rss'] # term = ['html', 'rss'] -enableEmoji = true - [languages] [languages.en] title = 'Hermit - V2' diff --git a/layouts/partials/rss-image.xml b/layouts/partials/rss-image.xml new file mode 100644 index 0000000..a874381 --- /dev/null +++ b/layouts/partials/rss-image.xml @@ -0,0 +1,29 @@ +{{/* This partial is to help `rss.xml` on generating proper links to images in feed */}} +{{- with $path := .path -}} +{{- if not (or (findRE `http[s]{0,1}://` $path 1) (findRE `^\/.*` $path 1)) -}} +{{- with resources.Get $path -}} + + + + {{ . }} + +{{- end -}} +{{- else if findRE `^\/.*` $path 1 -}} +{{ $path := printf "%s%s" .Site.BaseURL (strings.TrimLeft "/" $path) }} + {{- with resources.GetRemote $path -}} + + + + {{ . }} + + {{- end -}} +{{- else -}} + {{- with resources.GetRemote . -}} + + + + {{ . }} + + {{- end -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/layouts/posts/rss.xml b/layouts/posts/rss.xml index c215c54..898e3b5 100644 --- a/layouts/posts/rss.xml +++ b/layouts/posts/rss.xml @@ -1,9 +1,22 @@ - +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "" | safeHTML }} + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} {{ .Permalink }} Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io{{ with .Site.LanguageCode }} + Hugo -- {{ hugo.Version }}{{ with .Site.LanguageCode }} {{.}}{{end}}{{ with .Site.Params.author.email }} {{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Params.author.email }} {{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} @@ -12,15 +25,28 @@ {{ with .OutputFormats.Get "RSS" -}} {{ printf "" .Permalink .MediaType | safeHTML }} {{ end -}} - {{ range .Pages }} + {{- with $.Site.Params.images }} + + {{ site.Title }} + {{ index . 0 | absURL }} + {{ index . 0 | absURL }} + + {{- end }} + {{ range $pages }} {{ .Title }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Params.author.email }}{{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}{{end}} + {{- with .Page.Params.author | default .Site.Params.author.name -}}{{ . }}{{- end -}} {{ .Permalink }} - {{ printf `` .Page.Params.description | safeHTML }} - {{ printf `` .Content | safeHTML }} + {{- with .Page.Params.description | html }}{{ printf `` . | safeHTML }}{{ else }}{{ .Summary | html }}{{ end -}} + {{- with .Page.Params.featuredImg -}} + {{- partial "rss-image.xml" (dict "path" .) -}} + {{- end -}} + {{- range .Page.Params.images -}} + {{- partial "rss-image.xml" (dict "path" .) -}} + {{- end -}} + {{ (printf `` .Content) | safeHTML }} {{ end }}