add option to change default emoji icon

This commit is contained in:
tabinurie 2020-11-14 17:06:46 +09:00
parent 1c24a7a5c6
commit 2e96cb4cf1
8 changed files with 42 additions and 34 deletions

View File

@ -45,6 +45,14 @@ paginateWindow = 1
talksPaginate = 5 talksPaginate = 5
talksGroupByDate = "2006" talksGroupByDate = "2006"
pubPaginate = 20 pubPaginate = 20
writtenTimeIcon = "📅"
modifiedTimeIcon = "📝"
readingTimeIcon = "☕"
authorIcon = "✍️"
pagePvIcon = "👀"
tagIcon = "🏷️"
publicationIcon = "📚"
typeIcon = "🎯"
# whoami # whoami
myname = "zzossig" myname = "zzossig"

View File

@ -1,14 +1,14 @@
{{ $params := .Params }} {{ $params := .Params }}
<div class="single__infos"> <div class="single__infos">
<time class="single__info" title="{{ i18n "tooltip-written" }}">📅&nbsp;{{ .Date.Format (i18n "single-dateformat") }} </time> <time class="single__info" title="{{ i18n "tooltip-written" }}">{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }}&nbsp;{{ .Date.Format (i18n "single-dateformat") }} </time>
{{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }}
&nbsp;&middot;&nbsp; <time class="single__info" title="{{ i18n "tooltip-modified" }}"> 📝&nbsp;{{ .Lastmod.Format (i18n "single-dateformat") }} </time> &nbsp;&middot;&nbsp; <time class="single__info" title="{{ i18n "tooltip-modified" }}"> {{ ($.Site.Params.modifiedTimeIcon | safeHTML) | default "📝" }}&nbsp;{{ .Lastmod.Format (i18n "single-dateformat") }} </time>
{{ end }} {{ end }}
&nbsp;&middot;&nbsp; <span class="single__info" title="{{ i18n "tooltip-reading-time" }}">&nbsp;{{ .ReadingTime }}&nbsp;{{ i18n "reading-time" }} </span> &nbsp;&middot;&nbsp; <span class="single__info" title="{{ i18n "tooltip-reading-time" }}"> {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "" }}&nbsp;{{ .ReadingTime }}&nbsp;{{ i18n "reading-time" }} </span>
{{ with .Params.Author }} {{ with .Params.Author }}
&nbsp;&middot;&nbsp; <span class="single__info" title="{{ i18n "single-writtenBy" }}">{{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }}&nbsp;{{ . }}</span> &nbsp;&middot;&nbsp; <span class="single__info" title="{{ i18n "single-writtenBy" }}">{{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }}&nbsp;{{ . }}</span>
{{ end }} {{ end }}
<span class="single__info"> <span class="single__info">
{{ if (and .Site.Params.enableBusuanzi .Site.Params.busuanziPagePV) }} &middot; 👀<span id="busuanzi_value_page_pv">...</span> {{ i18n "counter-page-pv" }}{{ end }} {{ if (and .Site.Params.enableBusuanzi .Site.Params.busuanziPagePV) }} &middot; {{ ($.Site.Params.pagePvIcon | safeHTML) | default "👀" }}<span id="busuanzi_value_page_pv">...</span> {{ i18n "counter-page-pv" }}{{ end }}
</span> </span>
</div> </div>

View File

@ -1,9 +1,9 @@
{{ $taxo := "tags" }} {{ $taxo := "tags" }}
<ul class="single__tags caption"> <ul class="single__tags caption">
{{ if .Params.tags }} {{ if .Params.tags }}
🏷️ {{ ($.Site.Params.tagIcon | safeHTML) | default "🏷️" }}
{{ end }} {{ end }}
{{ range (.GetTerms "tags") }} {{ range (.GetTerms "tags") }}
<li><a href="{{ .Permalink }}" class="single__tag" title="{{ .LinkTitle }}">#{{ .LinkTitle }}</a></li> <li><a href="{{ .Permalink }}" class="single__tag" title="{{ .LinkTitle }}">#{{ .LinkTitle }}</a></li>
{{ end }} {{ end }}
</ul> </ul>

View File

@ -1 +1 @@
<span class="caption pub__meta">📅 {{ if .Params.publishDate }}{{ dateFormat (i18n "pub-dateformat") .Params.publishDate }}{{ end }}</span>{{ with .Params.authors }}<span class="caption pub__meta">✍️ {{ delimit . ", " }}</span>{{ end }}{{ with .Params.publication }}<span class="caption pub__meta">📚 {{ . }}</span>{{ end }}{{ with .Params.ENTRYTYPE }}<span class="caption pub__meta" data-entry-type="{{ . }}">🎯 {{ . }}</span>{{ end }} <span class="caption pub__meta">{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }} {{ if .Params.publishDate }}{{ dateFormat (i18n "pub-dateformat") .Params.publishDate }}{{ end }}</span>{{ with .Params.authors }}<span class="caption pub__meta">{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }} {{ delimit . ", " }}</span>{{ end }}{{ with .Params.publication }}<span class="caption pub__meta">{{ ($.Site.Params.publicationIcon | safeHTML) | default "📚" }} {{ . }}</span>{{ end }}{{ with .Params.ENTRYTYPE }}<span class="caption pub__meta" data-entry-type="{{ . }}">{{ ($.Site.Params.typeIcon | safeHTML) | default "🎯" }} {{ . }}</span>{{ end }}

View File

@ -47,28 +47,28 @@
if (obj.publishDate) { if (obj.publishDate) {
var dateSpan = document.createElement('span'); var dateSpan = document.createElement('span');
dateSpan.className = 'caption pub__meta'; 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); metaDiv.appendChild(dateSpan);
} }
if (obj.authors) { if (obj.authors) {
var authorsSpan = document.createElement('span'); var authorsSpan = document.createElement('span');
authorsSpan.className = 'caption pub__meta'; authorsSpan.className = 'caption pub__meta';
authorsSpan.innerText = '✍️ ' + obj.authors.toString(); authorsSpan.innerText = '{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }} ' + obj.authors.toString();
metaDiv.appendChild(authorsSpan); metaDiv.appendChild(authorsSpan);
} }
if (obj.publication) { if (obj.publication) {
var pubSpan = document.createElement('span'); var pubSpan = document.createElement('span');
pubSpan.className = 'caption pub__meta'; pubSpan.className = 'caption pub__meta';
pubSpan.innerText = '📚 ' + obj.publication; pubSpan.innerText = '{{ ($.Site.Params.publicationIcon | safeHTML) | default "📚" }} ' + obj.publication;
metaDiv.appendChild(pubSpan); metaDiv.appendChild(pubSpan);
} }
if (obj.ENTRYTYPE) { if (obj.ENTRYTYPE) {
var typeSpan = document.createElement('span'); var typeSpan = document.createElement('span');
typeSpan.className = 'caption pub__meta'; typeSpan.className = 'caption pub__meta';
typeSpan.innerText = '🎯 ' + obj.ENTRYTYPE; typeSpan.innerText = '{{ ($.Site.Params.typeIcon | safeHTML) | default "🎯" }} ' + obj.ENTRYTYPE;
metaDiv.appendChild(typeSpan); metaDiv.appendChild(typeSpan);
} }
@ -76,7 +76,7 @@
if (obj.tags && obj.tags.length) { if (obj.tags && obj.tags.length) {
tagsUl = document.createElement('ul'); tagsUl = document.createElement('ul');
tagsUl.setAttribute('class', 'pub__tags caption'); tagsUl.setAttribute('class', 'pub__tags caption');
tagsUl.innerHTML = '&nbsp;🏷️'; tagsUl.innerHTML = '&nbsp;{{ ($.Site.Params.tagIcon | safeHTML) | default "🏷️" }}';
for (var i = 0; i < obj.tags.length; i++) { for (var i = 0; i < obj.tags.length; i++) {
var tagLi = document.createElement('li'); var tagLi = document.createElement('li');
@ -147,28 +147,28 @@
if (obj.item.publishDate) { if (obj.item.publishDate) {
var dateSpan = document.createElement('span'); var dateSpan = document.createElement('span');
dateSpan.className = 'caption pub__meta'; 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); metaDiv.appendChild(dateSpan);
} }
if (obj.item.authors) { if (obj.item.authors) {
var authorsSpan = document.createElement('span'); var authorsSpan = document.createElement('span');
authorsSpan.className = 'caption pub__meta'; 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); metaDiv.appendChild(authorsSpan);
} }
if (obj.item.publication) { if (obj.item.publication) {
var pubSpan = document.createElement('span'); var pubSpan = document.createElement('span');
pubSpan.className = 'caption pub__meta'; pubSpan.className = 'caption pub__meta';
pubSpan.innerText = '📚 ' + obj.item.publication; pubSpan.innerText = '{{ ($.Site.Params.publicationIcon | safeHTML) | default "📚" }} ' + obj.item.publication;
metaDiv.appendChild(pubSpan); metaDiv.appendChild(pubSpan);
} }
if (obj.item.ENTRYTYPE) { if (obj.item.ENTRYTYPE) {
var typeSpan = document.createElement('span'); var typeSpan = document.createElement('span');
typeSpan.className = 'caption pub__meta'; typeSpan.className = 'caption pub__meta';
typeSpan.innerText = '🎯 ' + obj.item.ENTRYTYPE; typeSpan.innerText = '{{ ($.Site.Params.typeIcon | safeHTML) | default "🎯" }} ' + obj.item.ENTRYTYPE;
metaDiv.appendChild(typeSpan); metaDiv.appendChild(typeSpan);
} }
@ -176,7 +176,7 @@
if (obj.item.tags && obj.item.tags.length) { if (obj.item.tags && obj.item.tags.length) {
tagsUl = document.createElement('ul'); tagsUl = document.createElement('ul');
tagsUl.setAttribute('class', 'pub__tags caption'); tagsUl.setAttribute('class', 'pub__tags caption');
tagsUl.innerHTML = '&nbsp;🏷️'; tagsUl.innerHTML = '&nbsp;{{ ($.Site.Params.tagIcon | safeHTML) | default "🏷️" }}';
for (var j = 0; j < obj.item.tags.length; j++) { for (var j = 0; j < obj.item.tags.length; j++) {
var tagLi = document.createElement('li'); var tagLi = document.createElement('li');
@ -331,4 +331,4 @@
// shave // shave
shave('.pub__summary', 150); shave('.pub__summary', 150);
}); });
</script> </script>

View File

@ -2,13 +2,13 @@
<header> <header>
<h5 class="title h5"><a href='{{ .Permalink }}'>{{- with .Params.pinned -}}📌&nbsp;{{- end -}}{{ .Title }}</a> </h5> <h5 class="title h5"><a href='{{ .Permalink }}'>{{- with .Params.pinned -}}📌&nbsp;{{- end -}}{{ .Title }}</a> </h5>
<h6 class="subtitle caption"> <h6 class="subtitle caption">
<time title="{{ i18n "tooltip-written" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">📅{{ .Date.Format (i18n "summary-dateformat") }} </time> <time title="{{ i18n "tooltip-written" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }}{{ .Date.Format (i18n "summary-dateformat") }} </time>
{{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }}
<time title="{{ i18n "tooltip-modified" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </time> <time title="{{ i18n "tooltip-modified" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; {{ ($.Site.Params.modifiedTimeIcon | safeHTML) | default "📝" }} {{ .Lastmod.Format (i18n "summary-dateformat") }} </time>
{{ end }} {{ end }}
<span title="{{ i18n "tooltip-reading-time" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; ☕ {{ .ReadingTime }} {{ i18n "reading-time" }}</span> <span title="{{ i18n "tooltip-reading-time" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "" }} {{ .ReadingTime }} {{ i18n "reading-time" }}</span>
{{ with $.Param "author" }} {{ with $.Param "author" }}
&middot; <span title="{{ i18n "single-writtenBy" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ if $.Param "AuthorEmoji" }}{{ $.Param "AuthorEmoji" }}{{ else }}✍️{{ end }}&nbsp;{{ . }}</span> &middot; <span title="{{ i18n "single-writtenBy" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ if $.Param "AuthorEmoji" }}{{ $.Param "AuthorEmoji" }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }}&nbsp;{{ . }}</span>
{{ end }} {{ end }}
</h6> </h6>
</header> </header>
@ -45,4 +45,4 @@
{{ end }} {{ end }}
</div> </div>
<hr /> <hr />
</article> </article>

View File

@ -19,13 +19,13 @@
<header> <header>
<h5 class="title h5"><a href='{{ .Permalink }}'>{{- with .Params.pinned -}}📌&nbsp;{{- end -}}{{ .Title }}</a> </h5> <h5 class="title h5"><a href='{{ .Permalink }}'>{{- with .Params.pinned -}}📌&nbsp;{{- end -}}{{ .Title }}</a> </h5>
<h6 class="subtitle caption"> <h6 class="subtitle caption">
<time title="{{ i18n "tooltip-written" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">📅&nbsp;{{ .Date.Format (i18n "summary-dateformat") }} </time> <time title="{{ i18n "tooltip-written" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }}&nbsp;{{ .Date.Format (i18n "summary-dateformat") }} </time>
{{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }}
<time title="{{ i18n "tooltip-modified" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; 📝&nbsp;{{ .Lastmod.Format (i18n "summary-dateformat") }} </time> <time title="{{ i18n "tooltip-modified" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; {{ ($.Site.Params.modifiedTimeIcon | safeHTML) | default "📝" }}&nbsp;{{ .Lastmod.Format (i18n "summary-dateformat") }} </time>
{{ end }} {{ end }}
<span title="{{ i18n "tooltip-reading-time" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot;&nbsp;{{ .ReadingTime }}&nbsp;{{ i18n "reading-time" }} </span> <span title="{{ i18n "tooltip-reading-time" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "" }}&nbsp;{{ .ReadingTime }}&nbsp;{{ i18n "reading-time" }} </span>
{{ with $.Param "author" }} {{ with $.Param "author" }}
&middot; <span title="{{ i18n "single-writtenBy" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ if $.Param "authorEmoji" }}{{ $.Param "authorEmoji" }}{{ else }}✍️{{ end }}&nbsp;{{ . }}</span> &middot; <span title="{{ i18n "single-writtenBy" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ if $.Param "authorEmoji" }}{{ $.Param "authorEmoji" }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }}&nbsp;{{ . }}</span>
{{ end }} {{ end }}
</h6> </h6>
</header> </header>
@ -56,4 +56,4 @@
</div> </div>
<hr /> <hr />
</article> </article>

View File

@ -5,13 +5,13 @@
<header> <header>
<h5 class="title h6"><a href='{{ .Permalink }}'>{{- with .Params.pinned -}}📌&nbsp;{{- end -}}{{ .Title }}</a> </h5> <h5 class="title h6"><a href='{{ .Permalink }}'>{{- with .Params.pinned -}}📌&nbsp;{{- end -}}{{ .Title }}</a> </h5>
<h6 class="subtitle caption"> <h6 class="subtitle caption">
<time title="{{ i18n "tooltip-written" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">📅 {{ .Date.Format (i18n "summary-dateformat") }} </time> <time title="{{ i18n "tooltip-written" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ ($.Site.Params.writtenTimeIcon | safeHTML) | default "📅" }} {{ .Date.Format (i18n "summary-dateformat") }} </time>
{{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }} {{ if ne (.Date.Format (i18n "summary-dateformat")) (.Lastmod.Format (i18n "summary-dateformat")) }}
<time title="{{ i18n "tooltip-modified" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </time> <time title="{{ i18n "tooltip-modified" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; {{ ($.Site.Params.modifiedTimeIcon | safeHTML) | default "📝" }} {{ .Lastmod.Format (i18n "summary-dateformat") }} </time>
{{ end }} {{ end }}
<span title="{{ i18n "tooltip-reading-time" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; ☕ {{ .ReadingTime }} {{ i18n "reading-time" }}</span> <span title="{{ i18n "tooltip-reading-time" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}"> &middot; {{ ($.Site.Params.readingTimeIcon | safeHTML) | default "" }} {{ .ReadingTime }} {{ i18n "reading-time" }}</span>
{{ with $params.Author }} {{ with $params.Author }}
&middot; <span title="{{ i18n "single-writtenBy" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }}&nbsp;{{ . }}</span> &middot; <span title="{{ i18n "single-writtenBy" }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}{{ ($.Site.Params.authorIcon | safeHTML) | default "✍️" }}{{ end }}&nbsp;{{ . }}</span>
{{ end }} {{ end }}
</h6> </h6>
</header> </header>