refactor(article): remove color tag & add custom category color (#75)

closes: https://github.com/CaiJimmy/hugo-theme-stack/issues/71
This commit is contained in:
Jimmy Cai
2020-12-22 19:43:14 +01:00
committed by GitHub
parent 31c42bcfe7
commit e606dca404
3 changed files with 6 additions and 29 deletions
@@ -1,22 +1,10 @@
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" }}
{{- $context := . -}}
<div class="article-details">
{{ if .Params.categories }}
<header class="article-category">
{{ range (.GetTerms "categories") }}
{{ if and $image.exists $image.resource }}
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
<a href="{{ .RelPermalink }}"
class="color-tag"
data-image="{{ $20x.RelPermalink }}"
data-key="{{ $context.Slug }}"
data-hash="{{ $imageRaw.Data.Integrity }}">
{{ .LinkTitle }}
</a>
{{ else }}
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{ end }}
<a href="{{ .RelPermalink }}" {{ with .Params.style }}style="background-color: {{ .background }}; color: {{ .color }};"{{ end }}>
{{ .LinkTitle }}
</a>
{{ end }}
</header>
{{ end }}