chore(style): update code style and add an i18n word

This commit is contained in:
Dillon
2020-02-03 18:38:10 +08:00
parent 8aba226290
commit 52c7ad29a6
23 changed files with 270 additions and 155 deletions

View File

@@ -1,11 +1,11 @@
<figure>
{{- /* Lazyload */ -}}
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
<img src="{{ $loading.RelPermalink }}" data-sizes="auto" data-src="{{ .Destination | safeURL }}" alt="{{ .Text }}"{{ with .Title }} title="{{ . }}"{{ end }} class="lazyload">
<figcaption class="image-caption">
{{- if .Title -}}
{{- .Title -}}
{{- else -}}
{{- .Text -}}
{{- end -}}
</figcaption>
{{- $caption := .Title | default .Text -}}
{{- with $caption -}}
<figcaption class="image-caption">
{{- . -}}
</figcaption>
{{- end -}}
</figure>

View File

@@ -1,6 +1,8 @@
{{- /* LoveIt theme version detection */ -}}
{{- if ne .Site.Params.version "0.1.X" -}}
{{- errorf "\n\nThere are two possible situations that led to this error:\n 1. You haven't copied the config.toml yet. See https://github.com/dillonzq/LoveIt#installation \n 2. You have an incompatible update. See https://github.com//dillonzq/LoveIt/blob/master/CHANGELOG.md \n\n有两种可能的情况会导致这个错误发生:\n 1. 你还没有复制 config.toml 参考 https://github.com/dillonzq/LoveIt#installation \n 2. 你进行了一次不兼容的更新 参考 https://github.com//dillonzq/LoveIt/blob/master/CHANGELOG.md \n" -}}
{{- end -}}
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
@@ -12,10 +14,13 @@
{{- partial "head.html" . -}}
</head>
<body>
{{- /* Check theme isDark before body rendering */ -}}
<script>
window.isDark = (window.localStorage && window.localStorage.getItem('theme')) === 'dark';
window.isDark && document.body.classList.add('dark-theme');
</script>
{{- /* Body wrapper */ -}}
<div class="wrapper">
{{- partial "header.html" . -}}
<main class="main">
@@ -24,10 +29,14 @@
</div>
</main>
{{- partial "footer.html" . -}}
{{- partial "scripts.html" . -}}
</div>
{{- /* Dynamic to top button */ -}}
<a href="#" class="dynamic-to-top" id="dynamic-to-top" data-scroll>
<span>&nbsp;</span>
</a>
{{- /* Load scripts */ -}}
{{- partial "scripts.html" . -}}
</body>
</html>

View File

@@ -3,12 +3,13 @@
{{- end -}}
{{- define "content" -}}
{{- $data := .Data -}}
<div class="page archive">
{{- /* Title */ -}}
<h2 class="post-title animated pulse faster">
{{- T "all" | humanize}}{{ T .Section | default .Section | humanize -}}
</h2>
{{- /* Paginate */ -}}
{{- range (.Paginate (.Pages.GroupByDate "2006")).PageGroups -}}
<h3>{{ .Key }}</h3>
{{- range .Pages -}}

View File

@@ -2,9 +2,12 @@
{{- define "content" -}}
<div class="page single">
{{- /* Title */ -}}
<h1 class="post-title animated pulse faster">
{{- .Title -}}
</h1>
{{- /* Content */ -}}
<div class="post-content">
{{- partial "hook/content.html" .Content | safeHTML -}}
</div>

View File

@@ -1,26 +1,28 @@
<article class="post" itemscope itemtype="http://schema.org/Article">
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
{{- $author := .Params.author | default .Site.Author.name -}}
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
<!--featured_image-->
{{- /* Featured image */ -}}
{{- with .Params.featured_image -}}
<div class="post-featured-image-preview">
{{- $image := $.Params.featured_image_preview | default . -}}
{{- partial "image" $image -}}
</div>
{{- end -}}
<!-- end featured_image-->
{{- /* Title */ -}}
<h1 class="post-title post-list-title" itemprop="name headline">
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h1>
{{- /* Meta */ -}}
<div class="post-meta">
{{- $author := .Params.author | default .Site.Author.name -}}
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
<a class="author" href="{{ $author_link }}" rel="author" target="_blank">
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}&nbsp;
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}
</a>
{{ T "publish" }}&nbsp;<time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp;
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
{{ T "publish" }} <time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp;
{{- with .Params.categories -}}
<span class="post-category">
{{- T "included" -}}&nbsp;
@@ -34,6 +36,8 @@
</span>
{{- end -}}
</div>
{{- /* Content */ -}}
<div class="post-content">
{{- if .Params.show_description -}}
<p>
@@ -43,6 +47,8 @@
{{- partial "hook/content.html" .Summary | safeHTML -}}
{{- end -}}
</div>
{{- /* Footer */ -}}
<div class="post-footer">
<a href="{{ .Permalink }}">{{ T "readMore" }}</a>
{{- with .Params.tags -}}