chore(style): update code style

This commit is contained in:
Dillon
2020-01-31 22:53:04 +08:00
parent 344f0a9f41
commit 2a7611b5ae
36 changed files with 1204 additions and 970 deletions

View File

@@ -50,110 +50,7 @@
} }
} }
.post-toc { @import "../_partial/_post/toc";
display: block;
position: absolute;
width: 240px;
max-width: 300px;
margin-left: 980px;
padding: .8rem;
border-left: 1px solid $global-border-color;
word-wrap: break-word;
box-sizing: border-box;
top: 12rem;
.post-toc-title {
font-weight: 400;
text-transform: uppercase;
}
.post-toc-content {
&.always-active ul {
display: block;
}
>nav>ul {
margin: .625rem 0;
}
ul {
padding-left: .625rem;
list-style: none;
ul {
padding-left: 1.25rem;
display: none;
}
.has-active > ul {
display: block;
}
}
.toc-link.active {
color: $global-link-hover-color;
}
}
}
.post-toc-mobile {
display: none;
padding-top: .8rem;
details {
summary {
.post-toc-title {
display: block;
display: flex;
justify-content: space-between;
font-size: 1.2em;
font-weight: bold;
line-height: 2em;
padding: 0 .625rem;
background: $code-background-color;
i.details {
line-height: 2em;
}
.dark-theme & {
background: $code-background-color-dark;
}
}
&::-webkit-details-marker {
display: none;
}
}
}
details[open] {
i.details {
transform: rotate(180deg);
}
}
.post-toc-content {
border: 2px solid $code-background-color;
>nav>ul {
margin: .625rem 0;
}
ul {
padding-left: .625rem;
list-style: none;
ul {
padding-left: 1.25rem;
}
}
.dark-theme & {
border: 2px solid $code-background-color-dark;
}
}
}
.post-content { .post-content {
.post-dummy-target:target { .post-dummy-target:target {
@@ -454,101 +351,6 @@
} }
} }
.post-footer { @import "../_partial/_post/footer";
margin-top: 3rem;
.post-info { @import "../_partial/_post/comment";
border-bottom: 1px solid $global-border-color;
padding: 1rem 0 0.3rem;
.dark-theme & {
border-bottom: 1px solid $global-border-color-dark;
}
.post-info-line {
display: flex;
justify-content: space-between;
.post-info-mod {
font-size: 0.8em;
color: $global-font-secondary-color;
.dark-theme & {
color: $global-font-secondary-color-dark;
}
}
.post-info-license {
font-size: 0.8em;
color: $global-font-secondary-color;
.dark-theme & {
color: $global-font-secondary-color-dark;
}
}
.post-info-md
a {
font-size: 0.8em;
color: $post-link-color;
.dark-theme & {
color: $post-link-color-dark;
}
&:hover {
color: $post-link-hover-color;
.dark-theme & {
color: $post-link-hover-color-dark;
}
}
}
}
}
.post-info-more {
padding: 0.3rem 0 1rem;
display: flex;
justify-content: space-between;
font-size: 0.9rem;
}
.post-nav {
&::before,
&::after {
content: ' ';
display: table;
}
& a.prev,
& a.next {
font-size: 1rem;
font-weight: 600;
transition-duration: .3s;
transition-property: transform;
transition-timing-function: ease-out;
}
& a.prev {
float: left;
}
& a.prev:hover {
transform: translateX(-4px);
}
& a.next {
float: right;
}
& a.next:hover {
transform: translateX(4px);
}
}
}
.post-comment {
padding: 4rem 0;
}

View File

@@ -32,10 +32,10 @@
&.active { &.active {
font-weight: 900; font-weight: 900;
color: $navbar-active-color; color: $navbar-hover-color;
.dark-theme & { .dark-theme & {
color: $navbar-active-color-dark; color: $navbar-hover-color-dark;
} }
} }
} }

View File

@@ -31,11 +31,11 @@
} }
&:hover a { &:hover a {
color: $pagination-link-active-color; color: $pagination-link-hover-color;
} }
.dark-theme &:hover a { .dark-theme &:hover a {
color: $pagination-link-active-color-dark; color: $pagination-link-hover-color-dark;
} }
&:before, &:before,
@@ -44,14 +44,14 @@
content: ""; content: "";
width: 0; width: 0;
height: 3px; height: 3px;
background: $pagination-link-active-color; background: $pagination-link-hover-color;
transition: 0.3s; transition: 0.3s;
bottom: 0px; bottom: 0px;
} }
.dark-theme &:before, .dark-theme &:before,
.dark-theme &:after { .dark-theme &:after {
background: $pagination-link-active-color-dark; background: $pagination-link-hover-color-dark;
} }
&:before .active, &:before .active,
@@ -77,11 +77,11 @@
&.active { &.active {
a { a {
color: $pagination-link-active-color; color: $pagination-link-hover-color;
} }
.dark-theme & a { .dark-theme & a {
color: $pagination-link-active-color-dark; color: $pagination-link-hover-color-dark;
} }
&:before, &:before,

View File

@@ -0,0 +1,3 @@
.post-comment {
padding: 4rem 0;
}

View File

@@ -0,0 +1,94 @@
.post-footer {
margin-top: 3rem;
.post-info {
border-bottom: 1px solid $global-border-color;
padding: 1rem 0 0.3rem;
.dark-theme & {
border-bottom: 1px solid $global-border-color-dark;
}
.post-info-line {
display: flex;
justify-content: space-between;
.post-info-mod {
font-size: 0.8em;
color: $global-font-secondary-color;
.dark-theme & {
color: $global-font-secondary-color-dark;
}
}
.post-info-license {
font-size: 0.8em;
color: $global-font-secondary-color;
.dark-theme & {
color: $global-font-secondary-color-dark;
}
}
.post-info-md
a {
font-size: 0.8em;
color: $post-link-color;
.dark-theme & {
color: $post-link-color-dark;
}
&:hover {
color: $post-link-hover-color;
.dark-theme & {
color: $post-link-hover-color-dark;
}
}
}
}
}
.post-info-more {
padding: 0.3rem 0 1rem;
display: flex;
justify-content: space-between;
font-size: 0.9rem;
}
.post-nav {
&::before,
&::after {
content: ' ';
display: table;
}
& a.prev,
& a.next {
font-size: 1rem;
font-weight: 600;
transition-duration: .3s;
transition-property: transform;
transition-timing-function: ease-out;
}
& a.prev {
float: left;
}
& a.prev:hover {
transform: translateX(-4px);
}
& a.next {
float: right;
}
& a.next:hover {
transform: translateX(4px);
}
}
}

View File

@@ -0,0 +1,134 @@
.post-toc {
display: block;
position: absolute;
width: 240px;
max-width: 300px;
margin-left: 980px;
padding: .8rem;
border-left: 1px solid $global-border-color;
word-wrap: break-word;
box-sizing: border-box;
top: 12rem;
.dark-theme & {
border-left: 1px solid $global-border-color-dark;
}
.post-toc-title {
font-weight: 400;
text-transform: uppercase;
}
.post-toc-content {
&.always-active ul {
display: block;
}
>nav>ul {
margin: .625rem 0;
}
ul {
text-indent: -0.85rem;
padding-left: .625rem;
list-style: none;
a::before {
content: "|";
font-weight: bolder;
margin-right: .5rem;
color: $post-link-color;
.dark-theme & {
color: $post-link-color-dark;
}
}
ul {
padding-left: 1.25rem;
display: none;
}
.has-active > ul {
display: block;
}
}
.toc-link.active {
font-weight: bold;
color: $post-link-hover-color;
.dark-theme & {
color: $post-link-hover-color-dark;
}
&::before {
font-weight: bolder;
color: $post-link-hover-color;
.dark-theme & {
color: $post-link-hover-color-dark;
}
}
}
}
}
.post-toc-mobile {
display: none;
padding-top: .8rem;
details {
summary {
.post-toc-title {
display: block;
display: flex;
justify-content: space-between;
font-size: 1.2em;
font-weight: bold;
line-height: 2em;
padding: 0 .625rem;
background: $code-background-color;
i.details {
line-height: 2em;
}
.dark-theme & {
background: $code-background-color-dark;
}
}
&::-webkit-details-marker {
display: none;
}
}
}
details[open] {
i.details {
transform: rotate(180deg);
}
}
.post-toc-content {
border: 2px solid $code-background-color;
>nav>ul {
margin: .625rem 0;
}
ul {
padding-left: .625rem;
list-style: none;
ul {
padding-left: 1.25rem;
}
}
.dark-theme & {
border: 2px solid $code-background-color-dark;
}
}
}

View File

@@ -29,8 +29,8 @@ $global-link-hover-color-dark: #fff !default;
$global-border-color: #dcdcdc !default; $global-border-color: #dcdcdc !default;
$global-border-color-dark: #4a4b50 !default; $global-border-color-dark: #4a4b50 !default;
$navbar-active-color: #161209 !default; $navbar-hover-color: #161209 !default;
$navbar-active-color-dark: #fff !default; $navbar-hover-color-dark: #fff !default;
$post-link-color: #2d96bd !default; $post-link-color: #2d96bd !default;
$post-link-color-dark: #eee !default; $post-link-color-dark: #eee !default;
@@ -39,8 +39,8 @@ $post-link-hover-color-dark: #2d96bd !default;
$pagination-link-color: #2d96bd !default; $pagination-link-color: #2d96bd !default;
$pagination-link-color-dark: #a9a9b3 !default; $pagination-link-color-dark: #a9a9b3 !default;
$pagination-link-active-color: #000 !default; $pagination-link-hover-color: #000 !default;
$pagination-link-active-color-dark: #fff !default; $pagination-link-hover-color-dark: #fff !default;
// Color of the table background. // Color of the table background.
$table-background-color: #fff !default; $table-background-color: #fff !default;

View File

@@ -21,6 +21,8 @@ enableRobotsTXT = true
googleAnalytics = "" googleAnalytics = ""
# copyright description used only for seo schema # copyright description used only for seo schema
copyright = "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License." copyright = "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License."
# date format
dateFormatToUse = "2006-01-02"
# Markup related configuration in Hugo # Markup related configuration in Hugo
[markup] [markup]

View File

@@ -69,7 +69,7 @@ other = "<span class=leancloud-visitors-count></span> pageviews"
other = "Author" other = "Author"
[lastMod] [lastMod]
other = "This article is updated with %s" other = "The article was updated on %s"
[license] [license]
other = "Published under the %s license" other = "Published under the %s license"

View File

@@ -1,4 +1,6 @@
{{- define "title" }}{{ T "pageNotFound" | printf "404 %s" }} | {{ .Site.Title }}{{ end -}} {{- define "title" }}
{{- T "pageNotFound" | printf "404 %s" }} | {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}} {{- define "content" -}}
<div class="notfound"> <div class="notfound">

View File

@@ -1,6 +1,6 @@
<figure> <figure>
<img <img
{{ $res := resources.Get "svg/loading.svg" | minify }} {{- $res := resources.Get "svg/loading.svg" | minify -}}
src="{{ $res.RelPermalink }}" src="{{ $res.RelPermalink }}"
data-sizes="auto" data-sizes="auto"
data-src="{{ .Destination | safeURL }}" data-src="{{ .Destination | safeURL }}"

View File

@@ -6,7 +6,9 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title> <title>
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
</title>
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
</head> </head>
<body> <body>

View File

@@ -1,4 +1,6 @@
{{- define "title" }}{{ T "all" | humanize}}{{ T .Section | default .Section | humanize }} | {{ .Site.Title }}{{ end -}} {{- define "title" }}
{{- T "all" | humanize}}{{ T .Section | default .Section | humanize }} | {{ .Site.Title -}}
{{- end -}}
{{- define "content" -}} {{- define "content" -}}
{{- $data := .Data -}} {{- $data := .Data -}}

View File

@@ -7,21 +7,27 @@
</h1> </h1>
<div class="post-content"> <div class="post-content">
{{- $content := .Content -}} {{- $content := .Content -}}
{{- $REin := `:\(([\w- ]+?)\):` -}} {{- $REin := `:\(([\w- ]+?)\):` -}}
{{- $REout := `<i class="$1 fa-fw"></i>` -}} {{- $REout := `<i class="$1 fa-fw"></i>` -}}
{{- $content = replaceRE $REin $REout $content -}} {{- $content = replaceRE $REin $REout $content -}}
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}} {{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}} {{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
{{- $content = replaceRE $REin $REout $content -}} {{- $content = replaceRE $REin $REout $content -}}
{{- $REin = `<sup>\[return\]</sup>` -}} {{- $REin = `<sup>\[return\]</sup>` -}}
{{- $REout = printf "<sup>[%s]</sup>" (T "return") -}} {{- $REout = printf "<sup>[%s]</sup>" (T "return") -}}
{{- $content = replaceRE $REin $REout $content -}} {{- $content = replaceRE $REin $REout $content -}}
{{- $REin = `<(h[23456]) (id=".+?")>` -}} {{- $REin = `<(h[23456]) (id=".+?")>` -}}
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}} {{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
{{- $content = replaceRE $REin $REout $content -}} {{- $content = replaceRE $REin $REout $content -}}
{{- $REin = `<(.+) (id="fnref:.+?")>` -}} {{- $REin = `<(.+) (id="fnref:.+?")>` -}}
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}} {{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
{{- $content = replaceRE $REin $REout $content -}} {{- $content = replaceRE $REin $REout $content -}}
{{- $content | safeHTML -}} {{- $content | safeHTML -}}
</div> </div>
</div> </div>

View File

@@ -1,18 +1,18 @@
<article class="post" itemscope itemtype="http://schema.org/Article"> <article class="post" itemscope itemtype="http://schema.org/Article">
{{ $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} {{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
{{ $author := .Site.Author.name }} {{- $author := .Site.Author.name -}}
{{ if isset .Params "author" }} {{- if isset .Params "author" -}}
{{ $author = .Site.Author.name }} {{- $author = .Site.Author.name -}}
{{ end }} {{- end -}}
<!--featured_image--> <!--featured_image-->
{{ with .Params.featured_image }} {{- with .Params.featured_image -}}
{{ $image := $.Params.featured_image_preview | default . }} {{- $image := $.Params.featured_image_preview | default . -}}
<div class="post-featured-image-preview"> <div class="post-featured-image-preview">
{{ $res := resources.Get "svg/loading.svg" | minify }} {{- $res := resources.Get "svg/loading.svg" | minify -}}
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ $image }}" alt="featured image" class="lazyload"> <img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ $image }}" alt="featured image" class="lazyload">
</div> </div>
{{ end }} {{- end -}}
<!-- end featured_image--> <!-- end featured_image-->
<h1 class="post-title post-list-title" itemprop="name headline"> <h1 class="post-title post-list-title" itemprop="name headline">
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Title }}</a>
@@ -21,40 +21,43 @@
<div class="post-meta"> <div class="post-meta">
<a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle fa-fw"></i>{{ $author }}&nbsp;</a> <a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle fa-fw"></i>{{ $author }}&nbsp;</a>
{{ T "publish" }}&nbsp;<time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp; {{ T "publish" }}&nbsp;<time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp;
{{ with .Params.categories -}} {{- with .Params.categories -}}
<span class="post-category"> <span class="post-category">
{{ T "included" }} {{- T "included" -}}
{{ range . }} {{- range . -}}
{{- $name := . -}} {{- $name := . -}}
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} {{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
<i class="far fa-folder fa-fw"></i><a href="{{ .Permalink }}">{{ $name }}</a> <i class="far fa-folder fa-fw"></i>
{{ end -}} <a href="{{ .Permalink }}">{{ $name }}</a>
{{ end }} {{- end -}}
{{- end -}}
</span> </span>
{{- end }} {{- end -}}
</div> </div>
<div class="post-content"> <div class="post-content">
{{ if .Params.show_description }} {{- if .Params.show_description -}}
<p>{{ .Params.description }}</p> <p>
{{ else }} {{- .Params.description -}}
{{ $summary := .Summary }} </p>
{{ $REin := `:\(([\w- ]+?)\):` }} {{- else -}}
{{ $REout := `<i class="$1 fa-fw"></i>` }} {{- $summary := .Summary -}}
{{ $summary = replaceRE $REin $REout $summary }} {{- $REin := `:\(([\w- ]+?)\):` -}}
{{ $REin = `\[(.+?)\]\^\((.+?)\)` }} {{- $REout := `<i class="$1 fa-fw"></i>` -}}
{{ $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` }} {{- $summary = replaceRE $REin $REout $summary -}}
{{ $summary = replaceRE $REin $REout $summary }} {{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
{{ $summary | safeHTML }} {{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
{{ end }} {{- $summary = replaceRE $REin $REout $summary -}}
{{- $summary | safeHTML -}}
{{- end -}}
</div> </div>
<div class="post-footer"> <div class="post-footer">
<a href="{{ .Permalink }}">{{ T "readMore" }}</a> <a href="{{ .Permalink }}">{{ T "readMore" }}</a>
{{ with .Params.tags }} {{- with .Params.tags -}}
<div class="post-tags"> <div class="post-tags">
{{ range . }} {{- range . -}}
&nbsp;&nbsp;<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>{{ . }}</a></span> &nbsp;&nbsp;<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>{{ . }}</a></span>
{{ end }} {{- end -}}
</div> </div>
{{ end }} {{- end -}}
</div> </div>
</article> </article>

View File

@@ -1,4 +1,4 @@
{{ if eq (getenv "HUGO_ENV") "production" | and .IsPage | and (ne .Params.comment false) -}} {{- if eq (getenv "HUGO_ENV") "production" | and .IsPage | and (ne .Params.comment false) -}}
<!-- Disqus Comment System--> <!-- Disqus Comment System-->
{{- if .Site.Params.disqus.shortname -}} {{- if .Site.Params.disqus.shortname -}}
<div id="disqus_thread"></div> <div id="disqus_thread"></div>
@@ -22,18 +22,18 @@
<!-- gitalk Comment System--> <!-- gitalk Comment System-->
{{- if .Site.Params.gitalk.owner -}} {{- if .Site.Params.gitalk.owner -}}
<div id="gitalk-container"></div> <div id="gitalk-container"></div>
{{ if .Site.Params.cdn.gitalk_css }} {{- if .Site.Params.cdn.gitalk_css -}}
{{ .Site.Params.cdn.gitalk_css | safeHTML }} {{- .Site.Params.cdn.gitalk_css | safeHTML -}}
{{ else }} {{- else -}}
{{- $res := resources.Get "css/lib/gitalk/gitalk.css" | resources.Minify -}} {{- $res := resources.Get "css/lib/gitalk/gitalk.css" | resources.Minify -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}"> <link rel="stylesheet" href="{{ $res.RelPermalink }}">
{{ end }} {{- end -}}
{{ if .Site.Params.cdn.gitalk_js }} {{- if .Site.Params.cdn.gitalk_js -}}
{{ .Site.Params.cdn.gitalk_js | safeHTML }} {{ .Site.Params.cdn.gitalk_js | safeHTML -}}
{{ else }} {{- else -}}
{{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}} {{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
<script src="{{ $res.RelPermalink }}"></script> <script src="{{ $res.RelPermalink }}"></script>
{{ end }} {{- end -}}
<script type="text/javascript"> <script type="text/javascript">
var gitalk = new Gitalk({ var gitalk = new Gitalk({
id: "{{ .Date }}", id: "{{ .Date }}",
@@ -53,12 +53,12 @@
<!-- valine --> <!-- valine -->
{{- if .Site.Params.valine.enable -}} {{- if .Site.Params.valine.enable -}}
<div id="vcomments"></div> <div id="vcomments"></div>
{{ if .Site.Params.cdn.valine_js }} {{- if .Site.Params.cdn.valine_js -}}
{{ .Site.Params.cdn.valine_js | safeHTML }} {{- .Site.Params.cdn.valine_js | safeHTML -}}
{{ else }} {{- else -}}
{{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}} {{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
<script src="{{ $res.RelPermalink }}"></script> <script src="{{ $res.RelPermalink }}"></script>
{{ end }} {{- end -}}
<script type="text/javascript"> <script type="text/javascript">
new Valine({ new Valine({
el: "#vcomments", el: "#vcomments",
@@ -92,4 +92,4 @@
data-numposts="{{ .Site.Params.facebook.numPosts }}" data-numposts="{{ .Site.Params.facebook.numPosts }}"
></div> ></div>
{{- end -}} {{- end -}}
{{- end }} {{- end -}}

View File

@@ -1,12 +1,14 @@
<footer class="footer"> <footer class="footer">
<div class="copyright"> <div class="copyright">
<div class="copyright-line"> <div class="copyright-line">
{{ (printf (T "powered") `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a>`) | safeHTML }}&nbsp;|&nbsp;{{ T "theme" }}<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="external nofollow noopener noreffer">LoveIt<i class="far fa-heart fa-fw"></i></a> {{- (printf (T "powered") `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a>`) | safeHTML }}&nbsp;|&nbsp;{{ T "theme" }}<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="external nofollow noopener noreffer">LoveIt<i class="far fa-heart fa-fw"></i></a>
</div> </div>
<div class="copyright-line"> <div class="copyright-line">
<i class="far fa-copyright fa-fw"></i> <i class="far fa-copyright fa-fw"></i>
{{- with .Site.Params.since -}} {{- with .Site.Params.since -}}
<span itemprop="copyrightYear">{{ if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year }}</span> <span itemprop="copyrightYear">
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
</span>
{{- else -}} {{- else -}}
<span itemprop="copyrightYear">{{ now.Year }}</span> <span itemprop="copyrightYear">{{ now.Year }}</span>
{{- end -}} {{- end -}}

View File

@@ -1,27 +1,27 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noodp" /> <meta name="robots" content="noodp" />
<meta name="Description" content="{{ .Params.description | default .Site.Params.description }}"> <meta name="Description" content="{{ .Params.description | default .Site.Params.description }}">
{{ with .Site.Params.google_verification -}} {{- with .Site.Params.google_verification -}}
<meta name="google-site-verification" content="{{ . }}" /> <meta name="google-site-verification" content="{{ . }}" />
{{ end -}} {{- end -}}
{{ with .Site.Params.bing_verification -}} {{- with .Site.Params.bing_verification -}}
<meta name="msvalidate.01" content="{{ . }}" /> <meta name="msvalidate.01" content="{{ . }}" />
{{ end -}} {{- end -}}
{{ with .Site.Params.yandex_verification -}} {{- with .Site.Params.yandex_verification -}}
<meta name="yandex-verification" content="{{ . }}" /> <meta name="yandex-verification" content="{{ . }}" />
{{ end -}} {{- end -}}
{{ with .Site.Params.pinterest_verification -}} {{- with .Site.Params.pinterest_verification -}}
<meta name="p:domain_verify" content="{{ . }}" /> <meta name="p:domain_verify" content="{{ . }}" />
{{ end -}} {{- end -}}
{{ with .Site.Params.baidu_verification -}} {{- with .Site.Params.baidu_verification -}}
<meta name="baidu-site-verification" content="{{ . }}" /> <meta name="baidu-site-verification" content="{{ . }}" />
{{ end -}} {{- end -}}
{{ if .PrevInSection -}} {{- if .PrevInSection -}}
<link rel="prev" href="{{ .PrevInSection.Permalink }}" /> <link rel="prev" href="{{ .PrevInSection.Permalink }}" />
{{ end -}} {{- end -}}
{{ if .NextInSection -}} {{- if .NextInSection -}}
<link rel="next" href="{{ .NextInSection.Permalink }}" /> <link rel="next" href="{{ .NextInSection.Permalink }}" />
{{ end -}} {{- end -}}
<link rel="canonical" href="{{ .Permalink }}" /> <link rel="canonical" href="{{ .Permalink }}" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
@@ -31,26 +31,26 @@
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
{{ with .OutputFormats.Get "RSS" -}} {{- with .OutputFormats.Get "RSS" -}}
<link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}"> <link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
<link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}"> <link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
{{ end -}} {{- end -}}
{{ template "_internal/twitter_cards.html" . -}} {{- template "_internal/twitter_cards.html" . -}}
{{ partial "seo.html" . -}} {{- partial "seo.html" . -}}
{{ $res := resources.Get "css/style.scss" | toCSS | minify -}} {{- $res := resources.Get "css/style.scss" | toCSS | minify -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}"> <link rel="stylesheet" href="{{ $res.RelPermalink }}">
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.fontawesome_free_css -}} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.fontawesome_free_css -}}
{{ .Site.Params.cdn.fontawesome_free_css | safeHTML }} {{- .Site.Params.cdn.fontawesome_free_css | safeHTML -}}
{{ else -}} {{- else -}}
{{ $res = resources.Get "css/lib/fontawesome-free/all.min.css" | minify -}} {{- $res = resources.Get "css/lib/fontawesome-free/all.min.css" | minify -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}"> <link rel="stylesheet" href="{{ $res.RelPermalink }}">
{{ end }} {{- end -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.animate_css -}} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.animate_css -}}
{{ .Site.Params.cdn.animate_css | safeHTML }} {{- .Site.Params.cdn.animate_css | safeHTML -}}
{{ else -}} {{- else -}}
{{ $res = resources.Get "css/lib/animate/animate.min.css" | minify -}} {{ $res = resources.Get "css/lib/animate/animate.min.css" | minify -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}"> <link rel="stylesheet" href="{{ $res.RelPermalink }}">
{{ end }} {{- end -}}

View File

@@ -1,13 +1,17 @@
<nav class="navbar"> <nav class="navbar">
<div class="navbar-container"> <div class="navbar-container">
<div class="navbar-header animated bounceIn"> <div class="navbar-header animated bounceIn">
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> <a href="{{ .Site.BaseURL }}">
{{- .Site.Title -}}
</a>
</div> </div>
<div class="navbar-menu"> <div class="navbar-menu">
{{ $currentPage := . }} {{- $currentPage := . }}
{{ range .Site.Menus.main }} {{- range .Site.Menus.main -}}
<a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) | or (eq $currentPage.RelPermalink .URL) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name | safeHTML }}</a> <a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) | or (eq $currentPage.RelPermalink .URL) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">
{{ end }} {{- .Name | safeHTML -}}
</a>
{{- end -}}
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title={{ T "switchTheme" }}></i></a> <a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title={{ T "switchTheme" }}></i></a>
</div> </div>
</div> </div>
@@ -17,17 +21,21 @@
<div class="navbar-container"> <div class="navbar-container">
<div class="navbar-header"> <div class="navbar-header">
<div class="navbar-header-title animated bounceIn"> <div class="navbar-header-title animated bounceIn">
<a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a> <a href="{{.Site.BaseURL}}">
{{- .Site.Title -}}
</a>
</div> </div>
<div class="menu-toggle" id="menu-toggle"> <div class="menu-toggle" id="menu-toggle">
<span></span><span></span><span></span> <span></span><span></span><span></span>
</div> </div>
</div> </div>
<div class="navbar-menu" id="mobile-menu"> <div class="navbar-menu" id="mobile-menu">
{{ $currentPage := . }} {{- $currentPage := . -}}
{{ range .Site.Menus.main }} {{- range .Site.Menus.main -}}
<a class="menu-item" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name | safeHTML }}</a> <a class="menu-item" href="{{ .URL | absLangURL }}" title="{{ .Title }}">
{{ end }} {{- .Name | safeHTML -}}
</a>
{{- end -}}
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title={{ T "switchTheme" }}></i></a> <a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title={{ T "switchTheme" }}></i></a>
</div> </div>
</div> </div>

View File

@@ -1,32 +1,34 @@
<div class="home-intro"> <div class="home-intro">
{{ $avatar := "" }} {{- $avatar := "" -}}
{{ if .Site.Params.gravatar.email }} {{- if .Site.Params.gravatar.email -}}
{{ $avatar = (printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" (md5 .Site.Params.gravatar.email)) }} {{- $avatar = (printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" (md5 .Site.Params.gravatar.email)) -}}
{{ else if .Site.Params.avatar }} {{- else if .Site.Params.avatar -}}
{{ $avatar = .Site.Params.avatar }} {{- $avatar = .Site.Params.avatar -}}
{{ end }} {{- end -}}
{{ if $avatar }} {{- if $avatar -}}
<div class="home-avatar"> <div class="home-avatar">
<a href="/posts"> <a href="/posts">
<img src={{ $avatar | relURL }} alt="avatar"> <img src={{ $avatar | relURL }} alt="avatar">
</a> </a>
</div> </div>
{{ end }} {{- end -}}
{{ with .Site.Params.subtitle }} {{- with .Site.Params.subtitle -}}
<h2 class="home-description"> <h2 class="home-description">
{{ $id := md5 . | printf "tp-%s" }} {{- $id := md5 . | printf "tp-%s" -}}
<div id={{ printf "r%s" $id }} hidden=true>{{ . | safeHTML }}</div> <div id={{ printf "r%s" $id }} hidden=true>
{{- . | safeHTML -}}
</div>
<div id={{ $id }} class="typeit"></div> <div id={{ $id }} class="typeit"></div>
{{ with $.Scratch.Get "typeitMap" }} {{- with $.Scratch.Get "typeitMap" -}}
{{ $.Scratch.Set "typeitMap" (dict $id (slice $id) | merge .) }} {{- $.Scratch.Set "typeitMap" (dict $id (slice $id) | merge .) -}}
{{ else }} {{- else -}}
{{ $.Scratch.Set "typeitMap" (dict $id (slice $id)) }} {{- $.Scratch.Set "typeitMap" (dict $id (slice $id)) -}}
{{ end }} {{- end -}}
</h2> </h2>
{{ end }} {{- end -}}
<div class="home-social-links"> <div class="home-social-links">
{{ partial "home/social.html" . }} {{- partial "home/social.html" . -}}
</div> </div>
</div> </div>

View File

@@ -1,171 +1,285 @@
{{ with .Site.Params.Social.Github }} {{- with .Site.Params.Social.Github -}}
<a href="https://github.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-github-alt fa-fw" title="Github"></i></a> <a href="https://github.com/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-github-alt fa-fw" title="Github"></i>
{{ with .Site.Params.Social.LinkedIn }} </a>
<a href="https://linkedin.com/in/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-linkedin fa-fw" title="LinkedIn"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.LinkedIn -}}
{{ with .Site.Params.Social.Twitter }} <a href="https://linkedin.com/in/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://twitter.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-twitter fa-fw" title="Twitter"></i></a> <i class="fab fa-linkedin fa-fw" title="LinkedIn"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Instagram }} {{- end -}}
<a href="https://www.instagram.com/{{.}}/" rel="me noopener noreffer" target="_blank"><i class="fab fa-instagram fa-fw" title="Instagram"></i></a> {{- with .Site.Params.Social.Twitter -}}
{{ end }} <a href="https://twitter.com/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Facebook}} <i class="fab fa-twitter fa-fw" title="Twitter"></i>
<a href="https://facebook.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-facebook fa-fw" title="Facebook"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Telegram}} {{- with .Site.Params.Social.Instagram -}}
<a href="https://t.me/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-telegram-plane fa-fw" title="Telegram"></i></a> <a href="https://www.instagram.com/{{ . }}/" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-instagram fa-fw" title="Instagram"></i>
{{ with .Site.Params.Social.Medium}} </a>
<a href="https://medium.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-medium fa-fw" title="Medium"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Facebook}}
{{ with .Site.Params.Social.Gitlab}} <a href="https://facebook.com/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://gitlab.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-gitlab fa-fw" title="Gitlab"></i></a> <i class="fab fa-facebook fa-fw" title="Facebook"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Youtubelegacy}} {{- end -}}
<a href="https://www.youtube.com/user/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-youtube fa-fw" title="Youtube"></i></a> {{- with .Site.Params.Social.Telegram}}
{{ end }} <a href="https://t.me/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Youtubecustom}} <i class="fab fa-telegram-plane fa-fw" title="Telegram"></i>
<a href="https://www.youtube.com/c/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-youtube fa-fw" title="Youtube"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Youtubechannel}} {{- with .Site.Params.Social.Medium}}
<a href="https://www.youtube.com/channel/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-youtube fa-fw" title="Youtube"></i></a> <a href="https://medium.com/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-medium fa-fw" title="Medium"></i>
{{ with .Site.Params.Social.Tumblr}} </a>
<a href="https://{{.}}.tumblr.com" rel="me noopener noreffer" target="_blank"><i class="fab fa-tumblr fa-fw" title="Tumblr"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Gitlab}}
{{ with .Site.Params.Social.Quora}} <a href="https://gitlab.com/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://www.quora.com/profile/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-quora fa-fw" title="Quora"></i></a> <i class="fab fa-gitlab fa-fw" title="Gitlab"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Keybase}} {{- end -}}
<a href="https://keybase.io/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-keybase fa-fw" title="Keybase"></i></a> {{- with .Site.Params.Social.Youtubelegacy}}
{{ end }} <a href="https://www.youtube.com/user/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Pinterest}} <i class="fab fa-youtube fa-fw" title="Youtube"></i>
<a href="https://www.pinterest.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-pinterest fa-fw" title="Pinterest"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Reddit}} {{- with .Site.Params.Social.Youtubecustom}}
<a href="https://www.reddit.com/user/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-reddit fa-fw" title="Reddit"></i></a> <a href="https://www.youtube.com/c/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-youtube fa-fw" title="Youtube"></i>
{{ with .Site.Params.Social.Codepen}} </a>
<a href="https://codepen.io/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-codepen fa-fw" title="Codepen"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Youtubechannel}}
{{ with .Site.Params.Social.FreeCodeCamp}} <a href="https://www.youtube.com/channel/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://freecodecamp.org/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-free-code-camp fa-fw"></i></a> <i class="fab fa-youtube fa-fw" title="Youtube"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Bitbucket}} {{- end -}}
<a href="https://bitbucket.org/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-bitbucket fa-fw" title="Bitbucket"></i></a> {{- with .Site.Params.Social.Tumblr}}
{{ end }} <a href="https://{{ . }}.tumblr.com" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Stackoverflow}} <i class="fab fa-tumblr fa-fw" title="Tumblr"></i>
<a href="https://stackoverflow.com/users/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-stack-overflow fa-fw" title="Stackoverflow"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Weibo}} {{- with .Site.Params.Social.Quora}}
<a href="https://weibo.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-weibo fa-fw" title="Weibo"></i></a> <a href="https://www.quora.com/profile/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-quora fa-fw" title="Quora"></i>
{{ with .Site.Params.Social.Odnoklassniki}} </a>
<a href="https://ok.ru/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-odnoklassniki fa-fw" title="Odnoklassniki"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Keybase}}
{{ with .Site.Params.Social.VKontakte}} <a href="https://keybase.io/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://vk.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-vk fa-fw" title="VKontakte"></i></a> <i class="fab fa-keybase fa-fw" title="Keybase"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Flickr}} {{- end -}}
<a href="https://www.flickr.com/photos/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-flickr fa-fw" title="Flickr"></i></a> {{- with .Site.Params.Social.Pinterest}}
{{ end }} <a href="https://www.pinterest.com/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Xing}} <i class="fab fa-pinterest fa-fw" title="Pinterest"></i>
<a href="https://www.xing.com/profile/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-xing fa-fw" title="Xing"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Snapchat}} {{- with .Site.Params.Social.Reddit}}
<a href="https://www.snapchat.com/add/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-snapchat fa-fw" title="Snapchat"></i></a> <a href="https://www.reddit.com/user/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-reddit fa-fw" title="Reddit"></i>
{{ with .Site.Params.Social.Soundcloud}} </a>
<a href="https://soundcloud.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-soundcloud fa-fw" title="Soundcloud"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Codepen}}
{{ with .Site.Params.Social.Spotify}} <a href="https://codepen.io/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://open.spotify.com/user/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-spotify fa-fw" title="Spotify"></i></a> <i class="fab fa-codepen fa-fw" title="Codepen"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Bandcamp}} {{- end -}}
<a href="https://{{.}}.bandcamp.com/" rel="me noopener noreffer" target="_blank"><i class="fab fa-bandcamp fa-fw" title="Bandcamp"></i></a> {{- with .Site.Params.Social.FreeCodeCamp}}
{{ end }} <a href="https://freecodecamp.org/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Paypal}} <i class="fab fa-free-code-camp fa-fw"></i>
<a href="https://paypal.me/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-paypal fa-fw" title="Paypal"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Fivehundredpx}} {{- with .Site.Params.Social.Bitbucket}}
<a href="https://500px.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-500px fa-fw" title="Fivehundredpx"></i></a> <a href="https://bitbucket.org/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-bitbucket fa-fw" title="Bitbucket"></i>
{{ with .Site.Params.Social.Mix}} </a>
<a href="https://mix.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-mix fa-fw" title="Mix"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Stackoverflow}}
{{ with .Site.Params.Social.Goodreads}} <a href="https://stackoverflow.com/users/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://www.goodreads.com/user/show/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-goodreads fa-fw" title="Goodreads"></i></a> <i class="fab fa-stack-overflow fa-fw" title="Stackoverflow"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Lastfm}} {{- end -}}
<a href="https://www.last.fm/user/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-POP_lastfm fa-fw" title="Lastfm"></i></a> {{- with .Site.Params.Social.Weibo}}
{{ end }} <a href="https://weibo.com/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Foursquare}} <i class="fab fa-weibo fa-fw" title="Weibo"></i>
<a href="https://foursquare.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-foursquare fa-fw" title="Foursquare"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Hackernews}} {{- with .Site.Params.Social.Odnoklassniki}}
<a href="https://news.ycombinator.com/user?id={{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-hacker-news fa-fw" title="Hackernews"></i></a> <a href="https://ok.ru/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-odnoklassniki fa-fw" title="Odnoklassniki"></i>
{{ with .Site.Params.Social.Kickstarter}} </a>
<a href="https://kickstarter.com/profile/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-kickstarter fa-fw" title="Kickstarter"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.VKontakte}}
{{ with .Site.Params.Social.Patreon}} <a href="https://vk.com/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://patreon.com/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-patreon fa-fw" title="Patreon"></i></a> <i class="fab fa-vk fa-fw" title="VKontakte"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Steam}} {{- end -}}
<a href="https://steamcommunity.com/id/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-steam fa-fw" title="Steam"></i></a> {{- with .Site.Params.Social.Flickr}}
{{ end }} <a href="https://www.flickr.com/photos/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Twitch}} <i class="fab fa-flickr fa-fw" title="Flickr"></i>
<a href="https://www.twitch.tv/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-twitch fa-fw" title="Twitch"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Strava}} {{- with .Site.Params.Social.Xing}}
<a href="https://www.strava.com/athletes/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-strava fa-fw" title="Strava"></i></a> <a href="https://www.xing.com/profile/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-xing fa-fw" title="Xing"></i>
{{ with .Site.Params.Social.Skype}} </a>
<a href="skype:{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-skype fa-fw" title="Skype"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Snapchat}}
{{ with .Site.Params.Social.Whatsapp}} <a href="https://www.snapchat.com/add/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://wa.me/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-whatsapp fa-fw" title="Whatsapp"></i></a> <i class="fab fa-snapchat fa-fw" title="Snapchat"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Zhihu}} {{- end -}}
<a href="https://www.zhihu.com/people/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-zhihu fa-fw" title="Zhihu"></i></a> {{- with .Site.Params.Social.Soundcloud}}
{{ end }} <a href="https://soundcloud.com/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Angellist}} <i class="fab fa-soundcloud fa-fw" title="Soundcloud"></i>
<a href="https://angel.co/{{.}}" rel="me noopener noreffer" target="_blank"><i class="fab fa-angellist fa-fw" title="Angellist"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Slideshare}} {{- with .Site.Params.Social.Spotify}}
<a href="https://slideshare.com/{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-slideshare fa-fw" title="Slideshare"></i></a> <a href="https://open.spotify.com/user/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-spotify fa-fw" title="Spotify"></i>
{{ with .Site.Params.Social.Jsfiddle}} </a>
<a href="https://jsfiddle.com/{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-jsfiddle fa-fw" title="Jsfiddle"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Bandcamp}}
{{ with .Site.Params.Social.Deviantart}} <a href="https://{{ . }}.bandcamp.com/" rel="me noopener noreffer" target="_blank">
<a href="https://{{ . }}.deviantart.com/" rel="me noopener noreffer" target="_blank"><i class="fab fa-deviantart fa-fw" title="Deviantart"></i></a> <i class="fab fa-bandcamp fa-fw" title="Bandcamp"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Behance}} {{- end -}}
<a href="https://behance.net/{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-behance fa-fw" title="Behance"></i></a> {{- with .Site.Params.Social.Paypal}}
{{ end }} <a href="https://paypal.me/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Dribble}} <i class="fab fa-paypal fa-fw" title="Paypal"></i>
<a href="https://dribbble.com/{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-dribbble fa-fw" title="Dribble"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Wordpress}} {{- with .Site.Params.Social.Fivehundredpx}}
<a href="https://{{ . }}.wordpress.com" rel="me noopener noreffer" target="_blank"><i class="fab fa-wordpress fa-fw" title="Wordpress"></i></a> <a href="https://500px.com/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-500px fa-fw" title="Fivehundredpx"></i>
{{ with .Site.Params.Social.Vine}} </a>
<a href="https://vine.co/" rel="me noopener noreffer" target="_blank"><i class="fab fa-vine fa-fw" title="Vine"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Mix}}
{{ with .Site.Params.Social.Googlescholar}} <a href="https://mix.com/{{ . }}" rel="me noopener noreffer" target="_blank">
<a href="https://scholar.google.com/citations?{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-Googlescholar fa-fw" title="Googlescholar"></i></a> <i class="fab fa-mix fa-fw" title="Mix"></i>
{{ end }} </a>
{{ with .Site.Params.Social.Researchgate}} {{- end -}}
<a href="https://www.researchgate.net/profile/{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-researchgate fa-fw" title="Researchgate"></i></a> {{- with .Site.Params.Social.Goodreads}}
{{ end }} <a href="https://www.goodreads.com/user/show/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ with .Site.Params.Social.Mastodon}} <i class="fab fa-goodreads fa-fw" title="Goodreads"></i>
<a href="https://mastodon.social/{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-mastodon fa-fw" title="Mastodon"></i></a> </a>
{{ end }} {{- end -}}
{{ with .Site.Params.Social.Devto}} {{- with .Site.Params.Social.Lastfm}}
<a href="https://dev.to/{{ . }}" rel="me noopener noreffer" target="_blank"><i class="fab fa-dev fa-fw" title="Dev.To"></i></a> <a href="https://www.last.fm/user/{{ . }}" rel="me noopener noreffer" target="_blank">
{{ end }} <i class="fab fa-POP_lastfm fa-fw" title="Lastfm"></i>
{{ with .Site.Params.Social.Email}} </a>
<a href="mailto:{{.}}" rel="me noopener noreffer"><i class="far fa-envelope fa-fw" target="_blank" title="Email"></i></a> {{- end -}}
{{ end }} {{- with .Site.Params.Social.Foursquare}}
<a href="https://foursquare.com/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-foursquare fa-fw" title="Foursquare"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Hackernews}}
<a href="https://news.ycombinator.com/user?id={{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-hacker-news fa-fw" title="Hackernews"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Kickstarter}}
<a href="https://kickstarter.com/profile/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-kickstarter fa-fw" title="Kickstarter"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Patreon}}
<a href="https://patreon.com/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-patreon fa-fw" title="Patreon"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Steam}}
<a href="https://steamcommunity.com/id/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-steam fa-fw" title="Steam"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Twitch}}
<a href="https://www.twitch.tv/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-twitch fa-fw" title="Twitch"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Strava}}
<a href="https://www.strava.com/athletes/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-strava fa-fw" title="Strava"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Skype}}
<a href="skype:{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-skype fa-fw" title="Skype"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Whatsapp}}
<a href="https://wa.me/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-whatsapp fa-fw" title="Whatsapp"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Zhihu}}
<a href="https://www.zhihu.com/people/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-zhihu fa-fw" title="Zhihu"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Angellist}}
<a href="https://angel.co/{{ . }}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-angellist fa-fw" title="Angellist"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Slideshare}}
<a href="https://slideshare.com/{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-slideshare fa-fw" title="Slideshare"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Jsfiddle}}
<a href="https://jsfiddle.com/{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-jsfiddle fa-fw" title="Jsfiddle"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Deviantart}}
<a href="https://{{- . -}}.deviantart.com/" rel="me noopener noreffer" target="_blank">
<i class="fab fa-deviantart fa-fw" title="Deviantart"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Behance}}
<a href="https://behance.net/{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-behance fa-fw" title="Behance"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Dribble}}
<a href="https://dribbble.com/{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-dribbble fa-fw" title="Dribble"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Wordpress}}
<a href="https://{{- . -}}.wordpress.com" rel="me noopener noreffer" target="_blank">
<i class="fab fa-wordpress fa-fw" title="Wordpress"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Vine}}
<a href="https://vine.co/" rel="me noopener noreffer" target="_blank">
<i class="fab fa-vine fa-fw" title="Vine"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Googlescholar}}
<a href="https://scholar.google.com/citations?{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-Googlescholar fa-fw" title="Googlescholar"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Researchgate}}
<a href="https://www.researchgate.net/profile/{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-researchgate fa-fw" title="Researchgate"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Mastodon}}
<a href="https://mastodon.social/{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-mastodon fa-fw" title="Mastodon"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Devto}}
<a href="https://dev.to/{{- . -}}" rel="me noopener noreffer" target="_blank">
<i class="fab fa-dev fa-fw" title="Dev.To"></i>
</a>
{{- end -}}
{{- with .Site.Params.Social.Email}}
<a href="mailto:{{ . }}" rel="me noopener noreffer">
<i class="far fa-envelope fa-fw" target="_blank" title="Email"></i>
</a>
{{- end -}}

View File

@@ -1,26 +1,30 @@
{{ if gt $.Paginator.TotalPages 1 -}} {{- if gt $.Paginator.TotalPages 1 -}}
<ul class="pagination"> <ul class="pagination">
{{- $.Scratch.Set "paginator.ellipsed" false -}} {{- $.Scratch.Set "paginator.ellipsed" false -}}
{{ range $.Paginator.Pagers -}} {{- range $.Paginator.Pagers -}}
{{ $right := sub .TotalPages .PageNumber -}} {{- $right := sub .TotalPages .PageNumber -}}
{{ $showNumber := or (le .PageNumber 1) (eq $right 0) -}} {{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
{{ $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}} {{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}}
{{ if $showNumber -}} {{- if $showNumber -}}
{{ $.Scratch.Set "paginator.ellipsed" false -}} {{- $.Scratch.Set "paginator.ellipsed" false -}}
{{ $.Scratch.Set "paginator.shouldEllipse" false -}} {{- $.Scratch.Set "paginator.shouldEllipse" false -}}
{{ else -}} {{- else -}}
{{ $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}} {{- $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}}
{{ $.Scratch.Set "paginator.ellipsed" true -}} {{- $.Scratch.Set "paginator.ellipsed" true -}}
{{ end -}} {{- end -}}
{{ if $showNumber -}} {{- if $showNumber -}}
<li class="page-item {{ if eq . $.Paginator }}active{{ end }}"> <li class="page-item {{ if eq . $.Paginator }}active{{ end }}">
<span class="page-link"> <span class="page-link">
<a href="{{ .URL }}">{{ .PageNumber }}</a> <a href="{{ .URL }}">
{{- .PageNumber -}}
</a>
</span> </span>
</li> </li>
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}} {{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
<li class="page-item "><span class="page-link" aria-hidden="true">&hellip;</span></li> <li class="page-item ">
{{ end -}} <span class="page-link" aria-hidden="true">&hellip;</span>
{{ end -}} </li>
{{- end -}}
{{- end -}}
</ul> </ul>
{{- end }} {{- end -}}

View File

@@ -1,41 +1,49 @@
{{ $modify_date := .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}} {{- $modify_date := .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
<div class="post-footer" id="post-footer"> <div class="post-footer" id="post-footer">
<div class="post-info"> <div class="post-info">
<div class="post-info-line"> <div class="post-info-line">
<div class="post-info-mod"> <div class="post-info-mod">
<span>{{ printf (T "lastMod") $modify_date }}</span> <span>
{{- printf (T "lastMod") $modify_date -}}
</span>
</div> </div>
<div class="post-info-license"> <div class="post-info-license">
{{ if .Params.license }} {{- if .Params.license -}}
<span>{{ printf (T "license") .Params.license | safeHTML }}</span> <span>
{{ end }} {{- printf (T "license") .Params.license | safeHTML -}}
</span>
{{- end -}}
</div> </div>
</div> </div>
<div class="post-info-line"> <div class="post-info-line">
<div class="post-info-md"> <div class="post-info-md">
{{ if .Site.Params.linkToMarkdown }} {{- if .Site.Params.linkToMarkdown -}}
{{ with .OutputFormats.Get "markdown" }} {{- with .OutputFormats.Get "markdown" -}}
<span><a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">{{ T "seeMarkDown" }}</a></span> <span>
{{ end }} <a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">
{{ end }} {{- T "seeMarkDown" -}}
</a>
</span>
{{- end -}}
{{- end -}}
</div> </div>
<div class="post-info-share"> <div class="post-info-share">
{{ if and ( .Param "socialShare" ) (gt (len (.Param "share")) 0) }} {{- if and ( .Param "socialShare" ) (gt (len (.Param "share")) 0) -}}
<span>{{ partial "post/share.html" . }}</span> <span>
{{ end }} {{- partial "post/share.html" . -}}
</span>
{{- end -}}
</div> </div>
</div> </div>
</div> </div>
<div class="post-info-more"> <div class="post-info-more">
<section> <section>
{{ with .Params.tags }} {{- with .Params.tags -}}
{{ range . }} {{- range . -}}
<span class="tag"> <span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>{{ . }}</a></span>
<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>{{ . }}</a> {{- end -}}
</span> {{- end -}}
{{ end }}
{{ end }}
</section> </section>
<section> <section>
<span><a href="javascript:window.history.back();">{{ T "back" }}</a></span>&nbsp;|&nbsp;<span><a href="{{ .Site.BaseURL }}">{{ T "home" }}</a></span> <span><a href="javascript:window.history.back();">{{ T "back" }}</a></span>&nbsp;|&nbsp;<span><a href="{{ .Site.BaseURL }}">{{ T "home" }}</a></span>
@@ -43,11 +51,11 @@
</div> </div>
<div class="post-nav"> <div class="post-nav">
{{ if .PrevInSection }} {{- if .PrevInSection -}}
<a href="{{ .PrevInSection.Permalink }}" class="prev" rel="prev" title="{{ .PrevInSection.Title }}"><i class="fas fa-angle-left fa-fw"></i>{{ .PrevInSection.Title }}</a> <a href="{{ .PrevInSection.Permalink }}" class="prev" rel="prev" title="{{ .PrevInSection.Title }}"><i class="fas fa-angle-left fa-fw"></i>{{ .PrevInSection.Title }}</a>
{{ end }} {{- end -}}
{{ if .NextInSection }} {{ if .NextInSection }}
<a href="{{ .NextInSection.Permalink }}" class="next" rel="next" title="{{ .NextInSection.Title }}">{{ .NextInSection.Title }}<i class="fas fa-angle-right fa-fw"></i></a> <a href="{{ .NextInSection.Permalink }}" class="next" rel="next" title="{{ .NextInSection.Title }}">{{ .NextInSection.Title }}<i class="fas fa-angle-right fa-fw"></i></a>
{{ end }} {{- end -}}
</div> </div>
</div> </div>

View File

@@ -1,52 +1,52 @@
{{ if or (eq .Params.share.enable false) (eq .Site.Params.share.enable false) | not }} {{- if or (eq .Params.share.enable false) (eq .Site.Params.share.enable false) | not -}}
{{ if or .Params.Share.Twitter (and .Site.Params.Share.Twitter (ne .Params.Share.Twitter false)) }} {{- if or .Params.Share.Twitter (and .Site.Params.Share.Twitter (ne .Params.Share.Twitter false)) -}}
<a href="//twitter.com/share?url={{ .Permalink }}&amp;text={{ .Title }}&amp;via={{ .Site.Params.Social.Twitter }}" target="_blank" title="Share on Twitter"> <a href="//twitter.com/share?url={{ .Permalink }}&amp;text={{ .Title }}&amp;via={{ .Site.Params.Social.Twitter }}" target="_blank" title="Share on Twitter">
<i class="fab fa-twitter fa-fw"></i> <i class="fab fa-twitter fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.Facebook (and .Site.Params.Share.Facebook (ne .Params.Share.Facebook false)) }} {{- if or .Params.Share.Facebook (and .Site.Params.Share.Facebook (ne .Params.Share.Facebook false)) -}}
<a href="//www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" title="Share on Facebook"> <a href="//www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" title="Share on Facebook">
<i class="fab fa-facebook-square fa-fw"></i> <i class="fab fa-facebook-square fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.Reddit (and .Site.Params.Share.Reddit (ne .Params.Share.Reddit false)) }} {{- if or .Params.Share.Reddit (and .Site.Params.Share.Reddit (ne .Params.Share.Reddit false)) -}}
<a href="//reddit.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on Reddit"> <a href="//reddit.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on Reddit">
<i class="fab fa-reddit fa-fw"></i> <i class="fab fa-reddit fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.Linkedin (and .Site.Params.Share.Linkedin (ne .Params.Share.Linkedin false)) }} {{- if or .Params.Share.Linkedin (and .Site.Params.Share.Linkedin (ne .Params.Share.Linkedin false)) -}}
<a href="//www.linkedin.com/shareArticle?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on LinkedIn"> <a href="//www.linkedin.com/shareArticle?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on LinkedIn">
<i class="fab fa-linkedin fa-fw"></i> <i class="fab fa-linkedin fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.Pinterest (and .Site.Params.Share.Pinterest (ne .Params.Share.Pinterest false)) }} {{- if or .Params.Share.Pinterest (and .Site.Params.Share.Pinterest (ne .Params.Share.Pinterest false)) -}}
<a href="//www.pinterest.com/pin/create/button/?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="Share on Pinterest"> <a href="//www.pinterest.com/pin/create/button/?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="Share on Pinterest">
<i class="fab fa-pinterest fa-fw"></i> <i class="fab fa-pinterest fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.YCombinator (and .Site.Params.Share.YCombinator (ne .Params.Share.YCombinator false)) }} {{- if or .Params.Share.YCombinator (and .Site.Params.Share.YCombinator (ne .Params.Share.YCombinator false)) -}}
<a href="//news.ycombinator.com/submitlink?u={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="Share on Hacker News"> <a href="//news.ycombinator.com/submitlink?u={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="Share on Hacker News">
<i class="fab fa-y-combinator fa-fw"></i> <i class="fab fa-y-combinator fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.Mix (and .Site.Params.Share.Mix (ne .Params.Share.Mix false)) }} {{- if or .Params.Share.Mix (and .Site.Params.Share.Mix (ne .Params.Share.Mix false)) -}}
<a href="//mix.com/add?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="Share on Mix"> <a href="//mix.com/add?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="Share on Mix">
<i class="fab fa-mix fa-fw"></i> <i class="fab fa-mix fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.Tumblr (and .Site.Params.Share.Tumblr (ne .Params.Share.Tumblr false)) }} {{- if or .Params.Share.Tumblr (and .Site.Params.Share.Tumblr (ne .Params.Share.Tumblr false)) -}}
<a href="//www.tumblr.com/widgets/share/tool?canonicalUrl={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on Tumblr"> <a href="//www.tumblr.com/widgets/share/tool?canonicalUrl={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on Tumblr">
<i class="fab fa-tumblr fa-fw"></i> <i class="fab fa-tumblr fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.VK (and .Site.Params.Share.VK (ne .Params.Share.VK false)) }} {{- if or .Params.Share.VK (and .Site.Params.Share.VK (ne .Params.Share.VK false)) -}}
<a href="//vk.com/share.php?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on VKontakte "> <a href="//vk.com/share.php?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on VKontakte ">
<i class="fab fa-vk fa-fw"></i> <i class="fab fa-vk fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ if or .Params.Share.Weibo (and .Site.Params.Share.Weibo (ne .Params.Share.Weibo false)) }} {{- if or .Params.Share.Weibo (and .Site.Params.Share.Weibo (ne .Params.Share.Weibo false)) -}}
<a href="//service.weibo.com/share/share.php?url={{ .Permalink }}&amp;appkey=&amp;title={{ .Title }}{{ with $.Params.featured_image }}&amp;pic={{ . }}{{ end }}" target="_blank" title="Share on Weibo"> <a href="//service.weibo.com/share/share.php?url={{ .Permalink }}&amp;appkey=&amp;title={{ .Title }}{{ with $.Params.featured_image }}&amp;pic={{ . }}{{- end -}}" target="_blank" title="Share on Weibo">
<i class="fab fa-weibo fa-fw"></i> <i class="fab fa-weibo fa-fw"></i>
</a> </a>
{{ end }} {{- end -}}
{{ end }} {{- end -}}

View File

@@ -1,169 +1,178 @@
<!-- jQuery https://github.com/jquery/jquery --> <!-- jQuery https://github.com/jquery/jquery -->
{{ $jquery := "" }} {{- $jquery := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_js -}}
{{ $jquery = .Site.Params.cdn.jquery_js }} {{- $jquery = .Site.Params.cdn.jquery_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/jquery/jquery.slim.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/jquery/jquery.slim.min.js" | resources.Minify -}}
{{ $jquery = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $jquery = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
<!-- lazysizes https://github.com/aFarkas/lazysizes --> <!-- lazysizes https://github.com/aFarkas/lazysizes -->
{{ $lazysizes := "" }} {{- $lazysizes := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.lazysizes_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.lazysizes_js -}}
{{ $lazysizes = .Site.Params.cdn.lazysizes_js }} {{- $lazysizes = .Site.Params.cdn.lazysizes_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/lazysizes/lazysizes.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/lazysizes/lazysizes.min.js" | resources.Minify -}}
{{ $lazysizes = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $lazysizes = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
<!-- Smooth Scroll https://github.com/cferdinandi/smooth-scroll --> <!-- Smooth Scroll https://github.com/cferdinandi/smooth-scroll -->
{{ $smooth_scroll := "" }} {{- $smooth_scroll := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.smooth_scroll_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.smooth_scroll_js -}}
{{ $smooth_scroll = .Site.Params.cdn.smooth_scroll_js }} {{- $smooth_scroll = .Site.Params.cdn.smooth_scroll_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | resources.Minify -}}
{{ $smooth_scroll = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $smooth_scroll = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $smooth_scroll = delimit (slice $smooth_scroll "<script>window.scroll = new SmoothScroll('[data-scroll]', {speed: 300, speedAsDuration: true});</script>") "" }} {{- $smooth_scroll = delimit (slice $smooth_scroll "<script>window.scroll = new SmoothScroll('[data-scroll]', {speed: 300, speedAsDuration: true});</script>") "" -}}
<!-- KaTeX https://github.com/KaTeX/KaTeX --> <!-- KaTeX https://github.com/KaTeX/KaTeX -->
{{ $katex_css := "" }} {{- $katex_css := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_css }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_css -}}
{{ $katex_css = .Site.Params.cdn.katex_css }} {{- $katex_css = .Site.Params.cdn.katex_css -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "css/lib/katex/katex.min.css" | resources.Minify }} {{- $res := resources.Get "css/lib/katex/katex.min.css" | resources.Minify -}}
{{ $katex_css = printf "<link rel=\"stylesheet\" href=\"%s\">" $res.RelPermalink }} {{- $katex_css = printf "<link rel=\"stylesheet\" href=\"%s\">" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $katex_js := "" }} {{- $katex_js := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_js -}}
{{ $katex_js = .Site.Params.cdn.katex_js }} {{- $katex_js = .Site.Params.cdn.katex_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/katex/katex.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/katex/katex.min.js" | resources.Minify -}}
{{ $katex_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $katex_js = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $katex_auto_render_js := "" }} {{- $katex_auto_render_js := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_auto_render_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_auto_render_js -}}
{{ $katex_auto_render_js = .Site.Params.cdn.katex_auto_render_js }} {{- $katex_auto_render_js = .Site.Params.cdn.katex_auto_render_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/katex/auto-render.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/katex/auto-render.min.js" | resources.Minify -}}
{{ $katex_auto_render_js = printf "<script defer src=\"%s\" onload=\"renderMathInElement(document.body);\"></script>" $res.RelPermalink }} {{- $katex_auto_render_js = printf "<script defer src=\"%s\" onload=\"renderMathInElement(document.body);\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $katex := delimit (slice $katex_css $katex_js $katex_auto_render_js) "" }} {{- $katex := delimit (slice $katex_css $katex_js $katex_auto_render_js) "" -}}
<!-- mermaid https://github.com/knsv/mermaid --> <!-- mermaid https://github.com/knsv/mermaid -->
{{ $mermaid := "" }} {{- $mermaid := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.mermaid_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.mermaid_js -}}
{{ $mermaid = .Site.Params.cdn.mermaid_js }} {{- $mermaid = .Site.Params.cdn.mermaid_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/mermaid/mermaid.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/mermaid/mermaid.min.js" | resources.Minify -}}
{{ $mermaid = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $mermaid = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $mermaidInit := "<script>mermaid.initialize({startOnLoad: false, theme: null});</script>" }} {{- $mermaidInit := "<script>mermaid.initialize({startOnLoad: false, theme: null});</script>" -}}
{{ $mermaid = delimit (slice $mermaid $mermaidInit) "" }} {{- $mermaid = delimit (slice $mermaid $mermaidInit) "" -}}
<!-- ECharts https://github.com/apache/incubator-echarts --> <!-- ECharts https://github.com/apache/incubator-echarts -->
{{ $echarts_js := "" }} {{- $echarts_js := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_js -}}
{{ $echarts_js = .Site.Params.cdn.echarts_js }} {{- $echarts_js = .Site.Params.cdn.echarts_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/echarts/echarts.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/echarts/echarts.min.js" | resources.Minify -}}
{{ $echarts_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $echarts_js = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $echarts_macarons_js := "" }} {{- $echarts_macarons_js := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_macarons_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_macarons_js -}}
{{ $echarts_macarons_js = .Site.Params.cdn.echarts_macarons_js }} {{- $echarts_macarons_js = .Site.Params.cdn.echarts_macarons_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/echarts/macarons.js" | resources.Minify }} {{- $res := resources.Get "js/lib/echarts/macarons.js" | resources.Minify -}}
{{ $echarts_macarons_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $echarts_macarons_js = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $echarts := delimit (slice $echarts_js $echarts_macarons_js) "" }} {{- $echarts := delimit (slice $echarts_js $echarts_macarons_js) "" -}}
<!-- TypeIt https://github.com/alexmacarthur/typeit --> <!-- TypeIt https://github.com/alexmacarthur/typeit -->
{{ $typeit := "" }} {{- $typeit := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.typeit_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.typeit_js -}}
{{ $typeit = .Site.Params.cdn.typeit_js }} {{- $typeit = .Site.Params.cdn.typeit_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/typeit/typeit.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/typeit/typeit.min.js" | resources.Minify -}}
{{ $typeit = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $typeit = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
<!-- jQuery.countdown https://github.com/hilios/jQuery.countdown --> <!-- jQuery.countdown https://github.com/hilios/jQuery.countdown -->
{{ $countdown := "" }} {{- $countdown := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_countdown_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_countdown_js -}}
{{ $countdown = .Site.Params.cdn.jquery_countdown_js }} {{- $countdown = .Site.Params.cdn.jquery_countdown_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/jquery-countdown/jquery.countdown.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/jquery-countdown/jquery.countdown.min.js" | resources.Minify -}}
{{ $countdown = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $countdown = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
<!-- APlayer https://github.com/MoePlayer/APlayer --> <!-- APlayer https://github.com/MoePlayer/APlayer -->
{{ $aplayer_css := "" }} {{- $aplayer_css := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_css }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_css -}}
{{ $aplayer_css = .Site.Params.cdn.aplayer_css }} {{- $aplayer_css = .Site.Params.cdn.aplayer_css -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "css/lib/aplayer/APlayer.min.css" | resources.Minify }} {{- $res := resources.Get "css/lib/aplayer/APlayer.min.css" | resources.Minify -}}
{{ $aplayer_css = printf "<link rel=\"stylesheet\" href=\"%s\">" $res.RelPermalink }} {{- $aplayer_css = printf "<link rel=\"stylesheet\" href=\"%s\">" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $aplayer_js := "" }} {{- $aplayer_js := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_js -}}
{{ $aplayer_js = .Site.Params.cdn.aplayer_js }} {{- $aplayer_js = .Site.Params.cdn.aplayer_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/aplayer/APlayer.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/aplayer/APlayer.min.js" | resources.Minify -}}
{{ $aplayer_js = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $aplayer_js = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $aplayer := delimit (slice $aplayer_css $aplayer_js) "" }} {{- $aplayer := delimit (slice $aplayer_css $aplayer_js) "" -}}
<!-- MetingJS https://github.com/metowolf/MetingJS --> <!-- MetingJS https://github.com/metowolf/MetingJS -->
{{ $meting := "" }} {{- $meting := "" -}}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.meting_js }} {{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.meting_js -}}
{{ $meting = .Site.Params.cdn.meting_js }} {{- $meting = .Site.Params.cdn.meting_js -}}
{{ else }} {{- else -}}
{{ $res := resources.Get "js/lib/meting/Meting.min.js" | resources.Minify }} {{- $res := resources.Get "js/lib/meting/Meting.min.js" | resources.Minify -}}
{{ $meting = printf "<script src=\"%s\"></script>" $res.RelPermalink }} {{- $meting = printf "<script src=\"%s\"></script>" $res.RelPermalink -}}
{{ end }} {{- end -}}
{{ $jquery | safeHTML }} {{- $jquery | safeHTML -}}
{{ $lazysizes | safeHTML }} {{- $lazysizes | safeHTML -}}
{{ $smooth_scroll | safeHTML }} {{- $smooth_scroll | safeHTML -}}
{{ if .IsPage }} {{- if .IsPage -}}
{{/* dev feature */}} {{/* dev feature */}}
{{ if .Params.dev }} {{- if .Params.dev -}}
{{ with .Scratch.Get "echartsMap" }} {{- with .Scratch.Get "echartsMap" -}}
{{ $echarts | safeHTML }} {{- $echarts | safeHTML -}}
<script>window.echartsMap = { <script>
{{ range $key, $var := . }} window.echartsMap = {
{{ $key }}: {{ $var | safeJS }}, {{- range $key, $var := . -}}
{{ end }} {{- $key }}: {{ $var | safeJS -}},
};window.echartsArr=[];</script> {{- end -}}
{{ end }} };
{{ end }} window.echartsArr=[];
</script>
{{- end -}}
{{- end -}}
{{/* dev feature */}} {{/* dev feature */}}
{{ with .Scratch.Get "mermaidMap" }} {{- with .Scratch.Get "mermaidMap" -}}
{{ $mermaid | safeHTML }} {{- $mermaid | safeHTML -}}
<script>window.mermaidMap = {{ . | jsonify | safeJS }};</script> <script>
{{ end }} window.mermaidMap = {{ . | jsonify | safeJS }};
</script>
{{- end -}}
{{ if or .Params.math .Site.Params.math }} {{- if or .Params.math .Site.Params.math -}}
{{ $katex | safeHTML }} {{- $katex | safeHTML -}}
{{ end }} {{- end -}}
{{ if .Scratch.Get "music" }} {{- if .Scratch.Get "music" -}}
{{ $aplayer | safeHTML }} {{- $aplayer | safeHTML -}}
{{ $meting | safeHTML }} {{- $meting | safeHTML -}}
{{ end }} {{- end -}}
{{ with .Scratch.Get "countdownMap" }} {{- with .Scratch.Get "countdownMap" -}}
{{ $countdown | safeHTML }} {{- $countdown | safeHTML -}}
<script>window.countdownMap = {{ . | jsonify | safeJS }};</script> <script>
{{ end }} window.countdownMap = {{ . | jsonify | safeJS }};
{{ end }} </script>
{{- end -}}
{{- end -}}
{{ $typeitMap := .Scratch.Get "typeitMap" }} {{- $typeitMap := .Scratch.Get "typeitMap" -}}
{{ if $typeitMap }} {{- if $typeitMap -}}
{{ $typeit | safeHTML }} {{- $typeit | safeHTML -}}
{{ $typeitArr := slice }} {{- $typeitArr := slice -}}
{{ range $key, $val := $typeitMap }} {{- range $key, $val := $typeitMap -}}
{{ $typeitArr = $typeitArr | append (slice $val) }} {{- $typeitArr = $typeitArr | append (slice $val) -}}
{{ end }} {{- end -}}
<script>window.typeitArr = {{ $typeitArr | jsonify | safeJS }};</script> <script>
{{ end }} window.typeitArr = {{ $typeitArr | jsonify | safeJS }};
</script>
{{- end -}}
{{ $res := resources.Get "/js/blog.js" | resources.Minify }} {{- $res := resources.Get "/js/blog.js" | resources.Minify -}}
<script src="{{ $res.RelPermalink }}"></script> <script src="{{ $res.RelPermalink }}"></script>
{{ if not .Site.IsServer }} {{- if not .Site.IsServer -}}
{{ template "_internal/google_analytics_async.html" . }} {{- template "_internal/google_analytics_async.html" . -}}
{{ end }} {{- end -}}

View File

@@ -1,91 +1,91 @@
{{ if .IsHome -}} {{- if .IsHome -}}
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "http://schema.org", "@context": "http://schema.org",
"@type": "WebSite", "@type": "WebSite",
"url": "{{ .Site.BaseURL }}", "url": "{{ .Site.BaseURL }}",
{{ with .Site.Author.name }} {{- with .Site.Author.name -}}
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": "{{ . }}" "name": "{{ . }}"
}, },
{{ end }} {{- end -}}
{{ with .Site.Params.description }} {{- with .Site.Params.description -}}
"description": "{{ . }}", "description": "{{ . }}",
{{ end }} {{- end -}}
{{ with .Site.Params.image }} {{- with .Site.Params.image -}}
"image": "{{ .url | absURL }}", "image": "{{ .url | absURL }}",
{{ end }} {{- end -}}
{{ with .Site.Params.logo }} {{- with .Site.Params.logo -}}
"thumbnailUrl": "{{ .url | absURL }}", "thumbnailUrl": "{{ .url | absURL }}",
{{ end }} {{- end -}}
{{ with .Site.Copyright }} {{- with .Site.Copyright -}}
"license": "{{ . }}", "license": "{{ . }}",
{{ end }} {{- end -}}
"name": "{{ .Site.Title }}" "name": "{{ .Site.Title }}"
} }
</script> </script>
{{ else if .IsPage -}} {{ else if .IsPage -}}
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "http://schema.org", "@context": "http://schema.org",
"@type": "BlogPosting", "@type": "BlogPosting",
"headline": "{{ .Title }}", "headline": "{{ .Title }}",
"mainEntityOfPage": { "mainEntityOfPage": {
"@type": "WebPage", "@type": "WebPage",
"@id": "{{ .Permalink }}" "@id": "{{ .Permalink }}"
},
{{ if ge (.Param "lua.image.width") 696 }}
"image": {
"@type": "ImageObject",
"url": "{{ .Param "lua.image.url" | absURL }}",
"width": {{ .Param "lua.image.width" }},
"height": {{ .Param "lua.image.height" }}
}, },
{{ else if ge .Site.Params.image.width 696 }} {{- if ge (.Param "lua.image.width") 696 -}}
"image": { "image": {
"@type": "ImageObject", "@type": "ImageObject",
"url": "{{ .Site.Params.image.url | absURL }}", "url": "{{ .Param "lua.image.url" | absURL }}",
"width": {{ .Site.Params.image.width }}, "width": {{ .Param "lua.image.width" }},
"height": {{ .Site.Params.image.height }} "height": {{ .Param "lua.image.height" }}
}, },
{{ end }} {{- else if ge .Site.Params.image.width 696 -}}
"genre": "{{ .Type }}", "image": {
{{ with .Params.tags }} "@type": "ImageObject",
"keywords": "{{ delimit . ", " }}", "url": "{{ .Site.Params.image.url | absURL }}",
{{ end }} "width": {{ .Site.Params.image.width }},
"wordcount": {{ .WordCount }}, "height": {{ .Site.Params.image.height }}
"url": "{{ .Permalink }}", },
{{ if not .PublishDate.IsZero }} {{- end -}}
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}", "genre": "{{ .Type }}",
{{ else if not .Date.IsZero }} {{- with .Params.tags -}}
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}", "keywords": "{{ delimit . ", " }}",
{{ end }} {{- end -}}
{{ with .Lastmod }} "wordcount": {{ .WordCount }},
"dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }}", "url": "{{ .Permalink }}",
{{ end }} {{- if not .PublishDate.IsZero -}}
{{ with .Site.Copyright }} "datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
"license": "{{ . }}", {{- else if not .Date.IsZero -}}
{{ end }} "datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
{{ with .Site.Params.publisher }} {{- end -}}
"publisher": { {{- with .Lastmod -}}
"@type": "Organization", "dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
"name": "{{ .name }}", {{- end -}}
"logo": { {{- with .Site.Copyright -}}
"@type": "ImageObject", "license": "{{ . }}",
"url": "{{ .logo.url | absURL }}", {{- end -}}
"width": {{ .logo.width }}, {{- with .Site.Params.publisher -}}
"height": {{ .logo.height }} "publisher": {
} "@type": "Organization",
}, "name": "{{ .name }}",
{{ end }} "logo": {
{{ with .Site.Author.Name }} "@type": "ImageObject",
"author": { "url": "{{ .logo.url | absURL }}",
"@type": "Person", "width": {{ .logo.width }},
"name": "{{ . }}" "height": {{ .logo.height }}
}, }
{{ end }} },
"description": "{{ .Description }}" {{- end -}}
{{- with .Site.Author.Name -}}
"author": {
"@type": "Person",
"name": "{{ . }}"
},
{{- end -}}
"description": "{{ .Description }}"
} }
</script> </script>
{{ end }} {{- end -}}

View File

@@ -1,11 +1,11 @@
{{ define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end }} {{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
{{ define "content" }} {{- define "content" -}}
{{ $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} {{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
{{ $author := .Site.Author.name }} {{- $author := .Site.Author.name -}}
{{ if isset .Params "author" }} {{- if isset .Params "author" -}}
{{ $author = .Site.Author.name }} {{- $author = .Site.Author.name -}}
{{ end }} {{- end }}
<article class="warpper"> <article class="warpper">
<h1 class="post-title animated flipInX">{{ .Title }}</h1> <h1 class="post-title animated flipInX">{{ .Title }}</h1>
@@ -13,17 +13,17 @@
<div class="post-meta"> <div class="post-meta">
<div class="post-meta-main"> <div class="post-meta-main">
<a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle fa-fw"></i>{{ $author }}&nbsp;</a> <a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle fa-fw"></i>{{ $author }}&nbsp;</a>
{{ with .Params.categories -}} {{- with .Params.categories -}}
<span class="post-category"> <span class="post-category">
{{ T "included" }} {{- T "included" -}}
{{ range . }} {{- range . -}}
{{- $name := . -}} {{- $name := . -}}
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} {{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
<i class="far fa-folder fa-fw"></i><a href="{{ .Permalink }}">{{ $name }}</a> <i class="far fa-folder fa-fw"></i><a href="{{ .Permalink }}">{{ $name }}</a>
{{ end -}} {{- end -}}
{{ end }} {{- end -}}
</span> </span>
{{- end }} {{- end -}}
</div> </div>
<div class="post-meta-other"> <div class="post-meta-other">
<i class="far fa-calendar-alt fa-fw"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp; <i class="far fa-calendar-alt fa-fw"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp;
@@ -37,59 +37,70 @@
</div> </div>
</div> </div>
{{ with .Params.featured_image }} {{- with .Params.featured_image -}}
<div class="post-featured-image"> <div class="post-featured-image">
{{ $res := resources.Get "svg/loading.svg" | minify }} {{- $res := resources.Get "svg/loading.svg" | minify -}}
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ . }}" alt="featured image" class="lazyload"> <img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ . }}" alt="featured image" class="lazyload">
</div> </div>
{{ end }} {{- end -}}
{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}} {{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
<div class="post-toc" id="post-toc"> <div class="post-toc" id="post-toc">
<h2 class="post-toc-title">{{ T "toc" }}</h2> <h2 class="post-toc-title">{{ T "toc" }}</h2>
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }} {{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
<div class="post-toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}"> <div class="post-toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}">
{{ .TableOfContents }} {{- .TableOfContents -}}
</div> </div>
</div> </div>
<div class="post-toc-mobile" id="post-toc-mobile"> <div class="post-toc-mobile" id="post-toc-mobile">
<details> <details>
<summary><div class="post-toc-title"><span>{{ T "toc" }}</span><span><i class="details icon fas fa-angle-down"></i></span></div></summary> <summary>
<div class="post-toc-title">
<span>{{ T "toc" }}</span>
<span><i class="details icon fas fa-angle-down"></i></span>
</div>
</summary>
<div class="post-toc-content"> <div class="post-toc-content">
{{ $toc := .TableOfContents }} {{- $toc := .TableOfContents -}}
{{ $toc = replaceRE `id="TableOfContents"` `id="TableOfContentsMobile"` $toc }} {{- $toc = replaceRE `id="TableOfContents"` `id="TableOfContentsMobile"` $toc -}}
{{ $toc | safeHTML }} {{- $toc | safeHTML -}}
</div> </div>
</details> </details>
</div> </div>
{{- end }} {{- end -}}
<div class="post-content"> <div class="post-content">
{{ $content := .Content }} {{- $content := .Content -}}
{{ $REin := `:\(([\w- ]+?)\):` }}
{{ $REout := `<i class="$1 fa-fw"></i>` }} {{- $REin := `:\(([\w- ]+?)\):` -}}
{{ $content = replaceRE $REin $REout $content }} {{- $REout := `<i class="$1 fa-fw"></i>` -}}
{{ $REin = `\[(.+?)\]\^\((.+?)\)` }} {{- $content = replaceRE $REin $REout $content -}}
{{ $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` }}
{{ $content = replaceRE $REin $REout $content }} {{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
{{ $REin = `<sup>\[return\]</sup>` }} {{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
{{ $REout = printf "<sup>[%s]</sup>" (T "return") }} {{- $content = replaceRE $REin $REout $content -}}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<(h[23456]) (id=".+?")>` }} {{- $REin = `<sup>\[return\]</sup>` -}}
{{ $REout = `<a class="post-dummy-target" $2></a><$1>` }} {{- $REout = printf "<sup>[%s]</sup>" (T "return") -}}
{{ $content = replaceRE $REin $REout $content }} {{- $content = replaceRE $REin $REout $content -}}
{{ $REin = `<(.+) (id="fnref:.+?")>` }}
{{ $REout = `<a class="post-dummy-target" $2></a><$1>` }} {{- $REin = `<(h[23456]) (id=".+?")>` -}}
{{ $content = replaceRE $REin $REout $content }} {{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
{{ $content | safeHTML }} {{- $content = replaceRE $REin $REout $content -}}
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
{{- $content = replaceRE $REin $REout $content -}}
{{- $content | safeHTML -}}
</div> </div>
{{ partial "post/footer.html" . }} {{- partial "post/footer.html" . -}}
<div class="post-comment"> <div class="post-comment">
{{ if ( .Params.comment | default true ) }} {{- if ( .Params.comment | default true ) -}}
{{ partial "comments.html" . }} {{- partial "comments.html" . -}}
{{ end }} {{- end -}}
</div> </div>
</article> </article>
{{- end }} {{- end -}}

View File

@@ -1,42 +1,54 @@
{{ $_hugo_config := `{ "version": 1 }` -}} {{- $_hugo_config := `{ "version": 1 }` -}}
{{ $iconMap := dict "note" "fas fa-pencil-alt" -}} {{- $iconMap := dict "note" "fas fa-pencil-alt" -}}
{{ $iconMap = dict "abstract" "fas fa-list-ul" | merge $iconMap -}} {{- $iconMap = dict "abstract" "fas fa-list-ul" | merge $iconMap -}}
{{ $iconMap = dict "info" "fas fa-info-circle" | merge $iconMap -}} {{- $iconMap = dict "info" "fas fa-info-circle" | merge $iconMap -}}
{{ $iconMap = dict "tip" "fas fa-lightbulb" | merge $iconMap -}} {{- $iconMap = dict "tip" "fas fa-lightbulb" | merge $iconMap -}}
{{ $iconMap = dict "success" "fas fa-check-circle" | merge $iconMap -}} {{- $iconMap = dict "success" "fas fa-check-circle" | merge $iconMap -}}
{{ $iconMap = dict "question" "fas fa-question-circle" | merge $iconMap -}} {{- $iconMap = dict "question" "fas fa-question-circle" | merge $iconMap -}}
{{ $iconMap = dict "warning" "fas fa-exclamation-triangle" | merge $iconMap -}} {{- $iconMap = dict "warning" "fas fa-exclamation-triangle" | merge $iconMap -}}
{{ $iconMap = dict "failure" "fas fa-times-circle" | merge $iconMap -}} {{- $iconMap = dict "failure" "fas fa-times-circle" | merge $iconMap -}}
{{ $iconMap = dict "danger" "fas fa-skull-crossbones" | merge $iconMap -}} {{- $iconMap = dict "danger" "fas fa-skull-crossbones" | merge $iconMap -}}
{{ $iconMap = dict "bug" "fas fa-bug" | merge $iconMap -}} {{- $iconMap = dict "bug" "fas fa-bug" | merge $iconMap -}}
{{ $iconMap = dict "example" "fas fa-list-ol" | merge $iconMap -}} {{- $iconMap = dict "example" "fas fa-list-ol" | merge $iconMap -}}
{{ $iconMap = dict "quote" "fas fa-quote-right" | merge $iconMap -}} {{- $iconMap = dict "quote" "fas fa-quote-right" | merge $iconMap -}}
{{ $iconMap = dict "details" "fas fa-angle-down" | merge $iconMap -}} {{- $iconMap = dict "details" "fas fa-angle-down" | merge $iconMap -}}
{{ if .IsNamedParams -}} {{- if .IsNamedParams -}}
{{ $type := .Get "type" }} {{- $type := .Get "type" -}}
{{ if eq (.Get "details") "true" -}} {{- if eq (.Get "details") "true" -}}
<details class="admonition {{ $type }}"> <details class="admonition {{ $type }}">
{{- with .Get "title" }}<summary class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}<i class="details {{ index $iconMap "details" }}"></i></summary>{{ end }} {{- with .Get "title" -}}
<summary class="admonition-title">
<i class="icon {{ index $iconMap $type }}"></i>{{ . }}<i class="details {{ index $iconMap "details" }}"></i>
</summary>
{{- end -}}
{{- .Inner -}} {{- .Inner -}}
</details> </details>
{{- else -}} {{- else -}}
<div class="admonition {{ $type }}"> <div class="admonition {{ $type }}">
{{- with .Get "title" }}<p class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}</p>{{ end }} {{- with .Get "title" -}}
<p class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}</p>
{{- end -}}
{{- .Inner -}} {{- .Inner -}}
</div> </div>
{{- end -}} {{- end -}}
{{ else -}} {{- else -}}
{{ $type := .Get 0 }} {{- $type := .Get 0 -}}
{{ if eq (.Get 2) "true" }} {{- if eq (.Get 2) "true" -}}
<details class="admonition {{ $type }}"> <details class="admonition {{ $type }}">
{{- with .Get 1 }}<summary class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}<i class="details {{ index $iconMap "details" }}"></i></summary>{{ end }} {{- with .Get 1 -}}
<summary class="admonition-title">
<i class="icon {{ index $iconMap $type }}"></i>{{ . }}<i class="details {{ index $iconMap "details" }}"></i>
</summary>
{{- end -}}
{{- .Inner -}} {{- .Inner -}}
</details> </details>
{{- else -}} {{- else -}}
<div class="admonition {{ $type }}"> <div class="admonition {{ $type }}">
{{- with .Get 1 }}<p class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}</p>{{ end }} {{- with .Get 1 -}}
<p class="admonition-title"><i class="icon {{ index $iconMap $type }}"></i>{{ . }}</p>
{{- end -}}
{{- .Inner -}} {{- .Inner -}}
</div> </div>
{{- end -}} {{- end -}}
{{ end }} {{- end -}}

View File

@@ -1,12 +1,12 @@
{{ if .Get "date" -}} {{- if .Get "date" -}}
{{ $date := .Get "date" }} {{- $date := .Get "date" -}}
{{ $id := delimit (split (md5 $date) "" | shuffle) "" | printf "countdown-%s" -}} {{- $id := delimit (split (md5 $date) "" | shuffle) "" | printf "countdown-%s" -}}
{{ $defaultPattern := printf "%%D %s %%H %s %%M %s %%S %s" (T "day") (T "hour") (T "minute") (T "second") }} {{- $defaultPattern := printf "%%D %s %%H %s %%M %s %%S %s" (T "day") (T "hour") (T "minute") (T "second") -}}
{{ $new := dict $id (dict "date" $date "pattern" (.Get "pattern" | default $defaultPattern)) }} {{- $new := dict $id (dict "date" $date "pattern" (.Get "pattern" | default $defaultPattern)) -}}
{{ with .Page.Scratch.Get "countdownMap" -}} {{- with .Page.Scratch.Get "countdownMap" -}}
{{ .Page.Scratch.Set "countdownMap" (merge . $new) -}} {{- .Page.Scratch.Set "countdownMap" (merge . $new) -}}
{{ else -}} {{- else -}}
{{ .Page.Scratch.Set "countdownMap" $new -}} {{- .Page.Scratch.Set "countdownMap" $new -}}
{{ end -}} {{- end -}}
<div id="{{ $id }}" style={{ .Get "style" | safeCSS }}></div> <div id="{{ $id }}" style={{ .Get "style" | safeCSS }}></div>
{{ end -}} {{- end -}}

View File

@@ -1,10 +1,10 @@
<!-- shuffle md5 as id --> <!-- shuffle md5 as id -->
{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "echarts-%s" -}} {{- $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "echarts-%s" -}}
{{ $echartsMap := .Page.Scratch.Get "echartsMap" -}} {{- $echartsMap := .Page.Scratch.Get "echartsMap" -}}
{{ if $echartsMap -}} {{- if $echartsMap -}}
{{ $echartsMap = .Inner | printf "{%s}" | dict $id | merge $echartsMap -}} {{ $echartsMap = .Inner | printf "{%s}" | dict $id | merge $echartsMap -}}
{{ else -}} {{- else -}}
{{ $echartsMap = .Inner | printf "{%s}" | dict $id -}} {{ $echartsMap = .Inner | printf "{%s}" | dict $id -}}
{{ end -}} {{- end -}}
{{ .Page.Scratch.Set "echartsMap" $echartsMap -}} {{- .Page.Scratch.Set "echartsMap" $echartsMap -}}
<div class="echarts" id="{{ $id }}"></div> <div class="echarts" id="{{ $id }}"></div>

View File

@@ -1,10 +1,10 @@
<!-- shuffle md5 as id --> <!-- shuffle md5 as id -->
{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "mermaid-%s" -}} {{- $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "mermaid-%s" -}}
{{ $mermaidMap := .Page.Scratch.Get "mermaidMap" -}} {{- $mermaidMap := .Page.Scratch.Get "mermaidMap" -}}
{{ if $mermaidMap -}} {{- if $mermaidMap -}}
{{ $mermaidMap = trim .Inner "\n" | dict $id | merge $mermaidMap -}} {{- $mermaidMap = trim .Inner "\n" | dict $id | merge $mermaidMap -}}
{{ else -}} {{- else -}}
{{ $mermaidMap = trim .Inner "\n" | dict $id -}} {{- $mermaidMap = trim .Inner "\n" | dict $id -}}
{{ end -}} {{- end -}}
{{ .Page.Scratch.Set "mermaidMap" $mermaidMap -}} {{- .Page.Scratch.Set "mermaidMap" $mermaidMap -}}
<div class="mermaid" id="{{ $id }}"></div> <div class="mermaid" id="{{ $id }}"></div>

View File

@@ -1,22 +1,22 @@
{{ .Page.Scratch.Set "music" "true" -}} {{- .Page.Scratch.Set "music" "true" -}}
{{ if .IsNamedParams }} {{- if .IsNamedParams -}}
<meting-js server={{ .Get "server" }} type={{ .Get "type" }} id={{ .Get "id" }} <meting-js server={{ .Get "server" }} type={{ .Get "type" }} id={{ .Get "id" }}
{{ with .Get "autoplay" }} {{- with .Get "autoplay" -}}
autoplay={{ . }} autoplay={{ . }}
{{ end }} {{- end -}}
{{ with .Get "mini" }} {{- with .Get "mini" -}}
mini={{ . }} mini={{ . }}
{{ end }} {{- end -}}
{{ with .Get "fixed" }} {{- with .Get "fixed" -}}
fixed={{ . }} fixed={{ . }}
{{ end }} {{- end -}}
{{ with .Get "list-folded" }} {{- with .Get "list-folded" -}}
list-folded={{ . }} list-folded={{ . }}
{{ end }} {{- end -}}
{{ with .Get "list-max-height" }} {{- with .Get "list-max-height" -}}
list-max-height={{ . }} list-max-height={{ . }}
{{ end }} {{- end -}}
theme="#A9A9B3"></meting-js> theme="#A9A9B3"></meting-js>
{{ else }} {{- else -}}
<meting-js server={{ .Get 0 }} type={{ .Get 1 }} id={{ .Get 2 }} theme="#A9A9B3"></meting-js>></meting-js> <meting-js server={{ .Get 0 }} type={{ .Get 1 }} id={{ .Get 2 }} theme="#A9A9B3"></meting-js>></meting-js>
{{ end }} {{- end }}

View File

@@ -1,50 +1,56 @@
<!-- only the trailing newline is retained --> <!-- only the trailing newline is retained -->
{{ $content := replaceRE `(?s)^\n*(.*?)\n*$` "$1\n" .Inner }} {{- $content := replaceRE `(?s)^\n*(.*?)\n*$` "$1\n" .Inner -}}
<!-- shuffle md5 as id --> <!-- shuffle md5 as id -->
{{ $id := delimit (split (md5 $content) "" | shuffle) "" | printf "typeit-%s" }} {{- $id := delimit (split (md5 $content) "" | shuffle) "" | printf "typeit-%s" -}}
<div class={{ .Get "class" | default "typeit" }}> <div class={{ .Get "class" | default "typeit" }}>
<!-- raw html content --> <!-- raw html content -->
{{ if .Get "raw" }} {{- if .Get "raw" -}}
<div id={{ printf "r%s" $id }} hidden=true>{{ $content | safeHTML }}</div> <div id={{ printf "r%s" $id }} hidden=true>
{{- $content | safeHTML -}}
</div>
<div id={{ $id }}></div> <div id={{ $id }}></div>
{{ else if .Get "code" }} {{- else if .Get "code" -}}
<!-- highlight code content without line number --> <!-- highlight code content without line number -->
{{ $content = highlight $content (.Get "code") "linenos=false" }} {{- $content = highlight $content (.Get "code") "linenos=false" -}}
<!-- delete outer label --> <!-- delete outer label -->
{{ $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content }} {{- $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content -}}
<!-- parsing markdown links --> <!-- parsing markdown links -->
{{ $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content }} {{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content -}}
<!-- replace " " to "&nbsp;" and replace "\n" to "<br />" --> <!-- replace " " to "&nbsp;" and replace "\n" to "<br />" -->
{{ $content = replaceRE ` ` "&nbsp;" $content | replaceRE `(<\w+)&nbsp;` "$1 " | replaceRE `\n` "<br />" }} {{- $content = replaceRE ` ` "&nbsp;" $content | replaceRE `(<\w+)&nbsp;` "$1 " | replaceRE `\n` "<br />" -}}
<!-- fix "<br />" location error which is a bug of Typeit HTML parser --> <!-- fix "<br />" location error which is a bug of Typeit HTML parser -->
{{ $content = replaceRE `<br /></span>` "</span><br />" $content }} {{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
<div id={{ printf "r%s" $id }} hidden=true>{{ $content | safeHTML }}</div> <div id={{ printf "r%s" $id }} hidden=true>
{{- $content | safeHTML -}}
</div>
<div class="highlight" id={{ $id }}></div> <div class="highlight" id={{ $id }}></div>
{{ else }} {{- else -}}
{{ $tag := .Get "tag" | default "p" }} {{- $tag := .Get "tag" | default "p" -}}
{{ $content = $content | markdownify | chomp }} {{- $content = $content | markdownify | chomp -}}
<div id={{ printf "r%s" $id }} hidden=true>{{ $content | safeHTML }}</div> <div id={{ printf "r%s" $id }} hidden=true>
{{ printf "<%s id=%s></%s>" $tag $id $tag | safeHTML }} {{- $content | safeHTML -}}
{{ end }} </div>
{{- printf "<%s id=%s></%s>" $tag $id $tag | safeHTML -}}
{{- end -}}
{{ $typeitMap := .Page.Scratch.Get "typeitMap" }} {{- $typeitMap := .Page.Scratch.Get "typeitMap" -}}
{{ $group := slice $id }} {{- $group := slice $id -}}
{{ with .Get "group" }} {{- with .Get "group" -}}
{{ if $typeitMap }} {{- if $typeitMap -}}
{{ if index $typeitMap . }} {{- if index $typeitMap . -}}
{{ $group = index $typeitMap . | append $id }} {{- $group = index $typeitMap . | append $id -}}
{{ end }} {{- end -}}
{{ $typeitMap = dict . $group | merge $typeitMap }} {{- $typeitMap = dict . $group | merge $typeitMap -}}
{{ else }} {{- else -}}
{{ $typeitMap = dict . $group }} {{- $typeitMap = dict . $group -}}
{{ end }} {{- end -}}
{{ else }} {{- else -}}
{{ if $typeitMap }} {{- if $typeitMap -}}
{{ $typeitMap = dict $id $group | merge $typeitMap }} {{- $typeitMap = dict $id $group | merge $typeitMap -}}
{{ else }} {{- else -}}
{{ $typeitMap = dict $id $group }} {{- $typeitMap = dict $id $group -}}
{{ end }} {{- end -}}
{{ end }} {{- end -}}
{{ .Page.Scratch.Set "typeitMap" $typeitMap }} {{- .Page.Scratch.Set "typeitMap" $typeitMap -}}
</div> </div>

View File

@@ -1,29 +1,33 @@
{{ define "title" }}{{ .Title }} | {{ T .Data.Singular | default (humanize .Data.Singular) }} | {{ .Site.Title }}{{ end }} {{- define "title" -}}
{{- .Title }} | {{ T .Data.Singular | default (humanize .Data.Singular) }} | {{ .Site.Title -}}
{{- end -}}
{{ define "content" }} {{- define "content" -}}
<div class="warpper archive"> <div class="warpper archive">
<h2 class="post-title animated pulse faster"> <h2 class="post-title animated pulse faster">
{{ $taxonomy := .Data.Singular }} {{- $taxonomy := .Data.Singular -}}
{{ if eq $taxonomy "category" }} {{- if eq $taxonomy "category" -}}
<i class="far fa-folder-open fa-fw"></i>{{ .Title }} <i class="far fa-folder-open fa-fw"></i>{{ .Title }}
{{ else if eq $taxonomy "tag" }} {{- else if eq $taxonomy "tag" -}}
<i class="fas fa-tag fa-fw"></i>{{ .Title }} <i class="fas fa-tag fa-fw"></i>{{ .Title }}
{{ else }} {{- else -}}
{{ printf "%s - %s" (T $taxonomy | default (humanize $taxonomy)) .Title }} {{- printf "%s - %s" (T $taxonomy | default (humanize $taxonomy)) .Title -}}
{{ end }} {{- end -}}
</h2> </h2>
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} {{- range (.Paginate (.Pages.GroupByDate "2006")).PageGroups -}}
<h3>{{ .Key }}</h3> <h3>{{ .Key }}</h3>
{{ range .Pages }} {{- range .Pages -}}
<article class="archive-item"> <article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{ .Title }}</a> <a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
</a>
<span class="archive-item-date"> <span class="archive-item-date">
{{ .Date.Format (.Site.Params.dateFormatToUse | default "01-02") }} {{- .Date.Format (.Site.Params.dateFormatToUse | default "01-02") -}}
</span> </span>
</article> </article>
{{ end }} {{- end -}}
{{ end }} {{- end -}}
{{ partial "paginator.html" . }} {{- partial "paginator.html" . -}}
</div> </div>
{{end }} {{- end -}}

View File

@@ -1,51 +1,55 @@
{{ define "title" }}{{ T "all" | humanize}}{{ T .Data.Plural | default .Data.Plural | humanize }} | {{ .Site.Title }}{{ end }} {{- define "title" -}}
{{- T "all" | humanize}}{{ T .Data.Plural | default .Data.Plural | humanize }} | {{ .Site.Title -}}
{{- end -}}
{{ define "content" }} {{- define "content" -}}
{{ $taxonomies := .Data.Plural }} {{- $taxonomies := .Data.Plural -}}
{{ $terms := .Data.Terms.ByCount }} {{- $terms := .Data.Terms.ByCount -}}
{{ $type := .Type }} {{- $type := .Type -}}
<div class="warpper archive"> <div class="warpper archive">
<h2 class="post-title animated pulse faster"> <h2 class="post-title animated pulse faster">
{{ T "all" | humanize}}{{ T $taxonomies | default $taxonomies | humanize }} {{- T "all" | humanize}}{{ T $taxonomies | default $taxonomies | humanize -}}
</h2> </h2>
<!-- Categories Page --> <!-- Categories Page -->
{{ if eq $taxonomies "categories" }} {{- if eq $taxonomies "categories" -}}
<div class="categories-card"> <div class="categories-card">
{{ range $terms }} {{- range $terms -}}
{{ $term := .Term }} {{- $term := .Term -}}
{{ $pages := .Pages }} {{- $pages := .Pages -}}
{{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }} {{- with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) -}}
<div class="card-item"> <div class="card-item">
<div class="categories"> <div class="categories">
<a href="{{ .Permalink }}"> <a href="{{ .Permalink }}">
<h3><i class="far fa-folder fa-fw"></i>{{ $term | humanize}}</h3> <h3><i class="far fa-folder fa-fw"></i>{{ $term | humanize}}</h3>
</a> </a>
{{ range first 5 $pages }} {{- range first 5 $pages -}}
<article class="archive-item"> <article class="archive-item">
<a href="{{ .Permalink }}" class="archive-item-link">{{ .Title }}</a> <a href="{{ .Permalink }}" class="archive-item-link">
{{- .Title -}}
</a>
</article> </article>
{{ end }} {{- end -}}
{{ if gt (len $pages) 5 }} {{- if gt (len $pages) 5 -}}
<span class="more-post"> <span class="more-post">
<a href="{{ .Permalink }}" class="more-post-link">{{ T "more" }} >></a> <a href="{{ .Permalink }}" class="more-post-link">{{ T "more" }} >></a>
</span> </span>
{{ end }} {{- end -}}
</div> </div>
</div> </div>
{{ end }} {{- end -}}
{{ end }} {{- end -}}
</div> </div>
<!-- Tag Cloud Page --> <!-- Tag Cloud Page -->
{{ else if eq $taxonomies "tags" }} {{- else if eq $taxonomies "tags" -}}
<div class="tag-cloud-tags"> <div class="tag-cloud-tags">
{{ range $.Site.Taxonomies.tags.ByCount }} {{- range $.Site.Taxonomies.tags.ByCount -}}
<a href="{{ .Page.Permalink }}"> {{ .Page.Title }} <small>({{ .Count }})</small></a> <a href="{{ .Page.Permalink }}"> {{ .Page.Title }} <small>({{ .Count }})</small></a>
{{end}} {{- end -}}
</div> </div>
{{ end }} {{- end -}}
</div> </div>
{{end }} {{- end -}}

File diff suppressed because one or more lines are too long