mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
♻️ Refactor: refactor the feed and search features (#490)
* 🔍 Refactor: add JSON feed support and refactor output formats build in FixIt Close #475 * 🚚 Feat: migrate index templates to layouts/_default folder and home.[name].html * 📝 Style(ignore): fix typo * 🚚 Chore: migrate index templates to default home templates * 🚚 Chore: migrate section templates to layouts/section folder * ✨ Feat: add JSON feed support for section pages (#475) * 🚧 Feat: add common template for JSON feed (#475) * 🚧 Feat: add JSON feed support for section and term list pages * 🚀 Chore: fix git stage error in update-version script * ⚡ Perf: add front matter hiddenFromFeed for JSON feed (#475) * 🔍 Feat: add tags attribute for JSON feed (#475) * ♻️ Refactor: refactor RSS feed templates Close #488 * 🚧 WIP: rename json-feed.html to json.html * 🚧 Feat: revert single.md * ⚡ Perf: enhance JSON feed 1.1 compatibility * ♻️ Refactor: refactor post author map getting * ✨ WIP: add featured image support in feed * 📝 Docs: update README and screenshot * 🔧 Chore: update changelog template * 🚧 WIP: add feed scoped config for section and list * 🔥 Feat: migrate JSON feed to hugo-fixit/hugo-json-feed Close hugo-fixit/hugo-json-feed#1 * 🚚 Feat: remove front matter hiddenFromRss and rssFullText, add front matter hiddenFromFeed
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
{{- /*
|
||||
Get author in map format.
|
||||
|
||||
@param {String|Map} . the author name or map
|
||||
@returns {Map}
|
||||
|
||||
@example {{- $author := partial "function/get-author-map.html" .Params.author -}}
|
||||
*/ -}}
|
||||
|
||||
{{- if not (reflect.IsMap site.Params.author) -}}
|
||||
{{- errorf "FixIt params error: site.Params.author must be a map, got %T." site.Params.author -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $default := dict "name" "" "link" "" "email" "" "avatar" "" -}}
|
||||
{{- $author := site.Params.author | merge $default -}}
|
||||
{{- $authorParam := dict -}}
|
||||
{{- if reflect.IsMap . -}}
|
||||
{{- $authorParam = . -}}
|
||||
{{- else -}}
|
||||
{{- with . -}}
|
||||
{{- $authorParam = dict "name" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if isset $authorParam "name" | and (ne $authorParam.name site.Params.author.name) -}}
|
||||
{{- $author = $authorParam | merge $default | merge $author -}}
|
||||
{{- else -}}
|
||||
{{- with $authorParam.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}}
|
||||
{{- with $authorParam.email -}}{{ $author = dict "email" . | merge $author }}{{- end -}}
|
||||
{{- with $authorParam.avatar -}}{{ $author = dict "avatar" . | merge $author }}{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $gravatar := site.Params.gravatar -}}
|
||||
{{- if $gravatar.enable | and $author.email -}}
|
||||
{{- with $gravatar -}}
|
||||
{{- /* TODO migrate to gravatar */ -}}
|
||||
{{- $author = dict "avatar" (printf "https://%v/avatar/%v?s=32&d=%v"
|
||||
(path.Clean .Host | default "www.gravatar.com")
|
||||
(md5 $author.email)
|
||||
(.Style | default ""))
|
||||
| merge $author
|
||||
-}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $author -}}
|
||||
Reference in New Issue
Block a user