Merge branch 'master' into template-search

This commit is contained in:
Jimmy Cai 2020-10-10 10:05:31 +02:00 committed by GitHub
commit c266204f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 45 additions and 33 deletions

View File

@ -35,7 +35,12 @@ The only JavaScript library being used is [node-vibrant](https://github.com/Vibr
This theme uses SCSS and TypeScript. For that reason, it's necessary to use **Hugo ≥ 0.74.0**.
**Note**: You'll need Hugo Extended version to edit SCSS files
Use Hugo Extended version if you want to:
* Use the latest feature/fix from `master` branch
* Edit SCSS files
**Compiled CSS are updated once per release.**
## Installation

View File

@ -104,6 +104,7 @@
.article-tags {
flex-wrap: wrap;
text-transform: unset;
}
}
}

View File

@ -1,11 +1,12 @@
---
title: 中文文章内容测试
title: Chinese Test
description: 这是一个副标题
date: 2020-09-09
slug: test-chinese
image: helena-hertz-wWZzXlDpMog-unsplash.jpg
categories:
- Test
- 测试
---
## 正文测试

View File

@ -4,11 +4,13 @@ title = "Placeholder Text"
date = "2019-03-09"
description = "Lorem Ipsum Dolor Si Amet"
categories = [
"Test"
"Test",
"Test with whitespaces"
]
tags = [
"markdown",
"text",
"tag with whitespaces"
]
image = "matt-le-SJSpo9hQf7s-unsplash.jpg"
+++

View File

@ -1,18 +1,21 @@
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" }}
{{- $context := . -}}
{{- $categories := .Params.categories -}}
<div class="article-details">
{{ if $categories }}
{{ if .Params.categories }}
<header class="article-category">
{{ range $category := $categories }}
{{ $term := $.Site.GetPage (printf "/categories/%s" $category) }}
{{ range (.GetTerms "categories") }}
{{ if and $image.exists $image.resource }}
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
<a href="{{ $term.Permalink }}" class="color-tag"
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ $term.Title | humanize }}</a>
<a href="{{ .Permalink }}"
class="color-tag"
data-image="{{ $20x.RelPermalink }}"
data-key="{{ $context.Slug }}"
data-hash="{{ $imageRaw.Data.Integrity }}">
{{ .LinkTitle }}
</a>
{{ else }}
<a href="{{ $term.Permalink }}">{{ $term.Title | humanize }}</a>
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ end }}
{{ end }}
</header>
@ -32,7 +35,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

@ -1,10 +1,7 @@
{{- $tags := .Params.Tags -}}
{{ if $tags }}
{{ if .Params.Tags }}
<section class="article-tags">
{{ range $tag := $tags }}
{{ with $.Site.GetPage (printf "/tags/%s" $tag) }}
<a href="{{ .Permalink }}">{{ .Title | humanize }}</a>
{{ end }}
{{ range (.GetTerms "tags") }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ end }}
</section>
{{ end }}

View File

@ -2,7 +2,7 @@
<section class="copyright">&copy; {{ now.Format "2006" }} {{ .Site.Title }}</section>
<section class="powerby">
Built with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> <br />
Theme <b><a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="1.0.4">Stack</a></b> designed by
Theme <b><a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="1.0.5">Stack</a></b> designed by
<a href="https://jimmycai.com" target="_blank" rel="noopener">Jimmy</a>
</section>
</footer>

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,16 +1,13 @@
{{ $tags := .Site.Taxonomies.tags.ByCount }}
<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>
<div class="tagCloud-tags">
{{ range first .Site.Params.widgets.tagCloud.limit $tags }}
{{ $term := $.Site.GetPage (printf "/tags/%s" .Term) }}
<a href="{{ $term.Permalink }}" class="font_size_{{ .Count }}">
{{ $term.Title | humanize }}
{{ range first .Site.Params.widgets.tagCloud.limit .Site.Taxonomies.tags.ByCount }}
<a href="{{ .Page.Permalink }}" class="font_size_{{ .Count }}">
{{ .Page.Title }}
</a>
{{ end }}
</div>

File diff suppressed because one or more lines are too long