From 2e96cb4cf1fc585b15133a58ee75e0ec96fd9ba3 Mon Sep 17 00:00:00 2001 From: tabinurie Date: Sat, 14 Nov 2020 17:06:46 +0900 Subject: add option to change default emoji icon --- exampleSite/config/_default/params.toml | 8 ++++++++ layouts/partials/body/infos.html | 12 ++++++------ layouts/partials/body/tags.html | 4 ++-- layouts/partials/publication/pub-meta.html | 2 +- layouts/partials/script/pub-list-script.html | 22 +++++++++++----------- layouts/partials/summary/card.html | 10 +++++----- layouts/partials/summary/classic.html | 10 +++++----- layouts/partials/summary/compact.html | 8 ++++---- 8 files changed, 42 insertions(+), 34 deletions(-) diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index ca03c11..1b8be52 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -45,6 +45,14 @@ paginateWindow = 1 talksPaginate = 5 talksGroupByDate = "2006" pubPaginate = 20 +writtenTimeIcon = "📅" +modifiedTimeIcon = "📝" +readingTimeIcon = "☕" +authorIcon = "✍️" +pagePvIcon = "👀" +tagIcon = "🏷️" +publicationIcon = "📚" +typeIcon = "🎯" # whoami myname = "zzossig" diff --git a/layouts/partials/body/infos.html b/layouts/partials/body/infos.html index a80778f..632e50c 100644 --- a/layouts/partials/body/infos.html +++ b/layouts/partials/body/infos.html @@ -1,14 +1,14 @@ {{ $params := .Params }}
- + {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} -  ·  +  ·  {{ end }} -  ·  ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} +  ·  {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "☕" }} {{ .ReadingTime }} {{ i18n "reading-time" }} {{ with .Params.Author }} -  ·  {{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }} +  ·  {{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }} {{ . }} {{ end }} - {{ if (and .Site.Params.enableBusuanzi .Site.Params.busuanziPagePV) }} · 👀... {{ i18n "counter-page-pv" }}{{ end }} + {{ if (and .Site.Params.enableBusuanzi .Site.Params.busuanziPagePV) }} · {{ ($.Site.Params.pagePvIcon | safeHTML) | default "👀" }}... {{ i18n "counter-page-pv" }}{{ end }} -
\ No newline at end of file + diff --git a/layouts/partials/body/tags.html b/layouts/partials/body/tags.html index 0859aaf..7f94bf6 100644 --- a/layouts/partials/body/tags.html +++ b/layouts/partials/body/tags.html @@ -1,9 +1,9 @@ {{ $taxo := "tags" }} \ No newline at end of file + diff --git a/layouts/partials/publication/pub-meta.html b/layouts/partials/publication/pub-meta.html index 0d49f43..0ac9c17 100644 --- a/layouts/partials/publication/pub-meta.html +++ b/layouts/partials/publication/pub-meta.html @@ -1 +1 @@ -📅 {{ if .Params.publishDate }}{{ dateFormat (i18n "pub-dateformat") .Params.publishDate }}{{ end }}{{ with .Params.authors }}✍️ {{ delimit . ", " }}{{ end }}{{ with .Params.publication }}📚 {{ . }}{{ end }}{{ with .Params.ENTRYTYPE }}🎯 {{ . }}{{ end }} \ No newline at end of file +{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }} {{ if .Params.publishDate }}{{ dateFormat (i18n "pub-dateformat") .Params.publishDate }}{{ end }}{{ with .Params.authors }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }} {{ delimit . ", " }}{{ end }}{{ with .Params.publication }}{{ ($.Site.Params.publicationIcon | safeHTML) | default "📚" }} {{ . }}{{ end }}{{ with .Params.ENTRYTYPE }}{{ ($.Site.Params.typeIcon | safeHTML) | default "🎯" }} {{ . }}{{ end }} diff --git a/layouts/partials/script/pub-list-script.html b/layouts/partials/script/pub-list-script.html index 13c575a..1f5e9d3 100644 --- a/layouts/partials/script/pub-list-script.html +++ b/layouts/partials/script/pub-list-script.html @@ -47,28 +47,28 @@ if (obj.publishDate) { var dateSpan = document.createElement('span'); dateSpan.className = 'caption pub__meta'; - dateSpan.innerText = '📅 ' + obj.publishDate.slice(0, 10); + dateSpan.innerText = '{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }} ' + obj.publishDate.slice(0, 10); metaDiv.appendChild(dateSpan); } if (obj.authors) { var authorsSpan = document.createElement('span'); authorsSpan.className = 'caption pub__meta'; - authorsSpan.innerText = '✍️ ' + obj.authors.toString(); + authorsSpan.innerText = '{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }} ' + obj.authors.toString(); metaDiv.appendChild(authorsSpan); } if (obj.publication) { var pubSpan = document.createElement('span'); pubSpan.className = 'caption pub__meta'; - pubSpan.innerText = '📚 ' + obj.publication; + pubSpan.innerText = '{{ ($.Site.Params.publicationIcon | safeHTML) | default "📚" }} ' + obj.publication; metaDiv.appendChild(pubSpan); } if (obj.ENTRYTYPE) { var typeSpan = document.createElement('span'); typeSpan.className = 'caption pub__meta'; - typeSpan.innerText = '🎯 ' + obj.ENTRYTYPE; + typeSpan.innerText = '{{ ($.Site.Params.typeIcon | safeHTML) | default "🎯" }} ' + obj.ENTRYTYPE; metaDiv.appendChild(typeSpan); } @@ -76,7 +76,7 @@ if (obj.tags && obj.tags.length) { tagsUl = document.createElement('ul'); tagsUl.setAttribute('class', 'pub__tags caption'); - tagsUl.innerHTML = ' 🏷️'; + tagsUl.innerHTML = ' {{ ($.Site.Params.tagIcon | safeHTML) | default "🏷️" }}'; for (var i = 0; i < obj.tags.length; i++) { var tagLi = document.createElement('li'); @@ -147,28 +147,28 @@ if (obj.item.publishDate) { var dateSpan = document.createElement('span'); dateSpan.className = 'caption pub__meta'; - dateSpan.innerText = '📅 ' + obj.item.publishDate.slice(0, 10); + dateSpan.innerText = '{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }} ' + obj.item.publishDate.slice(0, 10); metaDiv.appendChild(dateSpan); } if (obj.item.authors) { var authorsSpan = document.createElement('span'); authorsSpan.className = 'caption pub__meta'; - authorsSpan.innerText = '✍️ ' + obj.item.authors.toString(); + authorsSpan.innerText = '{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }} ' + obj.item.authors.toString(); metaDiv.appendChild(authorsSpan); } if (obj.item.publication) { var pubSpan = document.createElement('span'); pubSpan.className = 'caption pub__meta'; - pubSpan.innerText = '📚 ' + obj.item.publication; + pubSpan.innerText = '{{ ($.Site.Params.publicationIcon | safeHTML) | default "📚" }} ' + obj.item.publication; metaDiv.appendChild(pubSpan); } if (obj.item.ENTRYTYPE) { var typeSpan = document.createElement('span'); typeSpan.className = 'caption pub__meta'; - typeSpan.innerText = '🎯 ' + obj.item.ENTRYTYPE; + typeSpan.innerText = '{{ ($.Site.Params.typeIcon | safeHTML) | default "🎯" }} ' + obj.item.ENTRYTYPE; metaDiv.appendChild(typeSpan); } @@ -176,7 +176,7 @@ if (obj.item.tags && obj.item.tags.length) { tagsUl = document.createElement('ul'); tagsUl.setAttribute('class', 'pub__tags caption'); - tagsUl.innerHTML = ' 🏷️'; + tagsUl.innerHTML = ' {{ ($.Site.Params.tagIcon | safeHTML) | default "🏷️" }}'; for (var j = 0; j < obj.item.tags.length; j++) { var tagLi = document.createElement('li'); @@ -331,4 +331,4 @@ // shave shave('.pub__summary', 150); }); - \ No newline at end of file + diff --git a/layouts/partials/summary/card.html b/layouts/partials/summary/card.html index 80e9446..0f3b0c9 100644 --- a/layouts/partials/summary/card.html +++ b/layouts/partials/summary/card.html @@ -2,13 +2,13 @@
{{- with .Params.pinned -}}📌 {{- end -}}{{ .Title }}
- + {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} - + {{ end }} - · ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} + · {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "☕" }} {{ .ReadingTime }} {{ i18n "reading-time" }} {{ with $.Param "author" }} - · {{ if $.Param "AuthorEmoji" }}{{ $.Param "AuthorEmoji" }}{{ else }}✍️{{ end }} {{ . }} + · {{ if $.Param "AuthorEmoji" }}{{ $.Param "AuthorEmoji" }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }} {{ . }} {{ end }}
@@ -45,4 +45,4 @@ {{ end }}
- \ No newline at end of file + diff --git a/layouts/partials/summary/classic.html b/layouts/partials/summary/classic.html index e43222c..d87c107 100644 --- a/layouts/partials/summary/classic.html +++ b/layouts/partials/summary/classic.html @@ -19,13 +19,13 @@
{{- with .Params.pinned -}}📌 {{- end -}}{{ .Title }}
- + {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} - + {{ end }} - · ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} + · {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "☕" }} {{ .ReadingTime }} {{ i18n "reading-time" }} {{ with $.Param "author" }} - · {{ if $.Param "authorEmoji" }}{{ $.Param "authorEmoji" }}{{ else }}✍️{{ end }} {{ . }} + · {{ if $.Param "authorEmoji" }}{{ $.Param "authorEmoji" }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }} {{ . }} {{ end }}
@@ -56,4 +56,4 @@
- \ No newline at end of file + diff --git a/layouts/partials/summary/compact.html b/layouts/partials/summary/compact.html index a815fdc..2074643 100644 --- a/layouts/partials/summary/compact.html +++ b/layouts/partials/summary/compact.html @@ -5,13 +5,13 @@
{{- with .Params.pinned -}}📌 {{- end -}}{{ .Title }}
- + {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} - + {{ end }} - · ☕ {{ .ReadingTime }} {{ i18n "reading-time" }} + · {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "☕" }} {{ .ReadingTime }} {{ i18n "reading-time" }} {{ with $params.Author }} - · {{ if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }} + · {{ if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }} {{ . }} {{ end }}
-- cgit v1.2.3