Merge pull request #29 from romainx/fix
Fix categories with special char or spaces not displayed correctly Co-authored-by: romainx <cros.romain@gmail.com>
This commit is contained in:
commit
4e646fe15e
@ -1,11 +1,12 @@
|
|||||||
---
|
---
|
||||||
title: 中文文章内容测试
|
title: Chinese Test
|
||||||
description: 这是一个副标题
|
description: 这是一个副标题
|
||||||
date: 2020-09-09
|
date: 2020-09-09
|
||||||
slug: test-chinese
|
slug: test-chinese
|
||||||
image: helena-hertz-wWZzXlDpMog-unsplash.jpg
|
image: helena-hertz-wWZzXlDpMog-unsplash.jpg
|
||||||
categories:
|
categories:
|
||||||
- Test
|
- Test
|
||||||
|
- 测试
|
||||||
---
|
---
|
||||||
|
|
||||||
## 正文测试
|
## 正文测试
|
||||||
|
@ -4,11 +4,13 @@ title = "Placeholder Text"
|
|||||||
date = "2019-03-09"
|
date = "2019-03-09"
|
||||||
description = "Lorem Ipsum Dolor Si Amet"
|
description = "Lorem Ipsum Dolor Si Amet"
|
||||||
categories = [
|
categories = [
|
||||||
"Test"
|
"Test",
|
||||||
|
"Test with whitespaces"
|
||||||
]
|
]
|
||||||
tags = [
|
tags = [
|
||||||
"markdown",
|
"markdown",
|
||||||
"text",
|
"text",
|
||||||
|
"tag with whitespaces"
|
||||||
]
|
]
|
||||||
image = "matt-le-SJSpo9hQf7s-unsplash.jpg"
|
image = "matt-le-SJSpo9hQf7s-unsplash.jpg"
|
||||||
+++
|
+++
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" }}
|
||||||
{{- $context := . -}}
|
{{- $context := . -}}
|
||||||
{{- $categories := .Params.categories -}}
|
|
||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
{{ if $categories }}
|
{{ if .Params.categories }}
|
||||||
<header class="article-category">
|
<header class="article-category">
|
||||||
{{ range $category := $categories }}
|
{{ range (.GetTerms "categories") }}
|
||||||
{{ $term := $.Site.GetPage (printf "/categories/%s" $category) }}
|
|
||||||
{{ if and $image.exists $image.resource }}
|
{{ if and $image.exists $image.resource }}
|
||||||
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
|
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
|
||||||
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
|
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
|
||||||
<a href="{{ $term.Permalink }}" class="color-tag"
|
<a href="{{ .Permalink }}" class="color-tag"
|
||||||
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ $term.Title | humanize }}</a>
|
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ .LinkTitle | humanize }}</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a href="{{ $term.Permalink }}">{{ $term.Title | humanize }}</a>
|
<a href="{{ .Permalink }}">{{ .LinkTitle | humanize }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</header>
|
</header>
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
{{- $tags := .Params.Tags -}}
|
{{ if .Params.Tags }}
|
||||||
{{ if $tags }}
|
|
||||||
<section class="article-tags">
|
<section class="article-tags">
|
||||||
{{ range $tag := $tags }}
|
{{ range (.GetTerms "tags") }}
|
||||||
{{ with $.Site.GetPage (printf "/tags/%s" $tag) }}
|
<a href="{{ .Permalink }}">{{ .LinkTitle | humanize }}</a>
|
||||||
<a href="{{ .Permalink }}">{{ .Title | humanize }}</a>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
{{ end }}
|
{{ end }}
|
@ -1,5 +1,3 @@
|
|||||||
{{ $tags := .Site.Taxonomies.tags.ByCount }}
|
|
||||||
|
|
||||||
<section class="widget tagCloud">
|
<section class="widget tagCloud">
|
||||||
<div class="widget-icon">
|
<div class="widget-icon">
|
||||||
{{ (resources.Get "icons/tag.svg").Content | safeHTML }}
|
{{ (resources.Get "icons/tag.svg").Content | safeHTML }}
|
||||||
@ -7,10 +5,9 @@
|
|||||||
<h1 class="widget-title">{{ T "widgetTagCloudTitle" }}</h1>
|
<h1 class="widget-title">{{ T "widgetTagCloudTitle" }}</h1>
|
||||||
|
|
||||||
<div class="tagCloud-tags">
|
<div class="tagCloud-tags">
|
||||||
{{ range first .Site.Params.widgets.tagCloud.limit $tags }}
|
{{ range first .Site.Params.widgets.tagCloud.limit .Site.Taxonomies.tags.ByCount }}
|
||||||
{{ $term := $.Site.GetPage (printf "/tags/%s" .Term) }}
|
<a href="{{ .Page.Permalink }}" class="font_size_{{ .Count }}">
|
||||||
<a href="{{ $term.Permalink }}" class="font_size_{{ .Count }}">
|
{{ .Page.Title | humanize }}
|
||||||
{{ $term.Title | humanize }}
|
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user