merge(#33): from icon-helper to master

feat(helper): add helper/icon
This commit is contained in:
Jimmy Cai 2020-10-10 00:33:28 +02:00 committed by GitHub
commit fc0e7c847c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 6 deletions

View file

@ -30,7 +30,7 @@
{{- if not .Date.IsZero -}}
<footer class="article-time">
{{ (resources.Get "icons/clock.svg").Content | safeHTML }}
{{ partial "helper/icon" "clock" }}
<time class="article-time--published">
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
</time>

View file

@ -3,14 +3,14 @@
{{ if and (.Site.Params.article.license.enabled) (not (eq .Params.license false)) }}
<section class="article-copyright">
{{ (resources.Get "icons/copyright.svg").Content | safeHTML }}
{{ partial "helper/icon" "copyright" }}
<span>{{ default .Site.Params.article.license.default .Params.license }}</span>
</section>
{{ end }}
{{- if ne .Lastmod .Date -}}
<section class="article-time">
{{ (resources.Get "icons/clock.svg").Content | safeHTML }}
{{ partial "helper/icon" "clock" }}
<span class="article-time--modified">
{{ T "lastUpdatedOn" }} {{ .Lastmod.Format ( or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006 15:04 MST" ) }}
</span>

View file

@ -0,0 +1,6 @@
{{- $iconFile := resources.GetMatch (printf "icons/%s.svg" .) -}}
{{- if $iconFile -}}
{{- $iconFile.Content | safeHTML -}}
{{- else -}}
{{- errorf "Error: icon '%s.svg' is not found under 'assets/icons' folder" . -}}
{{- end -}}

View file

@ -33,7 +33,7 @@
<li {{ if $active }} class='current' {{ end }}>
<a href='{{ .URL | absLangURL }}'>
{{ if .Pre }}
{{ (resources.Get (delimit (slice "icons/" .Pre ".svg") "")).Content | safeHTML }}
{{ partial "helper/icon" .Pre }}
{{ end }}
<span>{{- .Name -}}</span>
</a>

View file

@ -1,6 +1,6 @@
<section class="widget archives">
<div class="widget-icon">
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
{{ partial "helper/icon" "infinity" }}
</div>
<h1 class="widget-title">{{ T "widgetArchivesTitle" }}</h1>

View file

@ -1,6 +1,6 @@
<section class="widget tagCloud">
<div class="widget-icon">
{{ (resources.Get "icons/tag.svg").Content | safeHTML }}
{{ partial "helper/icon" "tag" }}
</div>
<h1 class="widget-title">{{ T "widgetTagCloudTitle" }}</h1>