feat(author): add author_link and fix highlight bug
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<figure>
|
||||
<img
|
||||
{{- $res := resources.Get "svg/loading.svg" | minify -}}
|
||||
{{ $res := resources.Get "svg/loading.svg" | minify -}}
|
||||
src="{{ $res.RelPermalink }}"
|
||||
data-sizes="auto"
|
||||
data-src="{{ .Destination | safeURL }}"
|
||||
alt="{{ .Text }}"
|
||||
{{- with .Title -}}
|
||||
{{ with .Title -}}
|
||||
title="{{ . }}"
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
class="lazyload"
|
||||
>
|
||||
<figcaption class="image-caption">
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<a href="{{ .Destination | safeURL }}"
|
||||
{{- with .Title -}}
|
||||
{{ with .Title -}}
|
||||
title="{{ . }}"
|
||||
{{- end -}}
|
||||
{{- if strings.HasPrefix .Destination "http" -}}
|
||||
{{ end -}}
|
||||
{{ if strings.HasPrefix .Destination "http" -}}
|
||||
target="_blank"
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
>
|
||||
{{- .Text -}}
|
||||
</a>
|
||||
@@ -17,7 +17,7 @@
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<sup>\[return\]</sup>` -}}
|
||||
{{- $REout = printf "<sup>[%s]</sup>" (T "return") -}}
|
||||
{{- $REout = `↩︎` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
||||
@@ -28,6 +28,10 @@
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
||||
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $content | safeHTML -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<article class="post" itemscope itemtype="http://schema.org/Article">
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
{{- $author := .Site.Author.name -}}
|
||||
{{- if isset .Params "author" -}}
|
||||
{{- $author = .Site.Author.name -}}
|
||||
{{- end -}}
|
||||
{{- $author := .Params.author | default .Site.Author.name -}}
|
||||
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
|
||||
|
||||
<!--featured_image-->
|
||||
{{- with .Params.featured_image -}}
|
||||
@@ -19,11 +17,13 @@
|
||||
</h1>
|
||||
|
||||
<div class="post-meta">
|
||||
<a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle fa-fw"></i>{{ $author }} </a>
|
||||
<a class="author" href="{{ $author_link }}" rel="author" target="_blank">
|
||||
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}
|
||||
</a>
|
||||
{{ T "publish" }} <time datetime={{ $publish_date }}>{{ $publish_date }}</time>
|
||||
{{- with .Params.categories -}}
|
||||
<span class="post-category">
|
||||
{{- T "included" -}}
|
||||
{{- T "included" -}}
|
||||
{{- range . -}}
|
||||
{{- $name := . -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
|
||||
@@ -41,12 +41,15 @@
|
||||
</p>
|
||||
{{- else -}}
|
||||
{{- $summary := .Summary -}}
|
||||
|
||||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
||||
{{- $summary = replaceRE $REin $REout $summary -}}
|
||||
|
||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- $summary = replaceRE $REin $REout $summary -}}
|
||||
|
||||
{{- $summary | safeHTML -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
@@ -55,7 +58,9 @@
|
||||
{{- with .Params.tags -}}
|
||||
<div class="post-tags">
|
||||
{{- range . -}}
|
||||
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>{{ . }}</a></span>
|
||||
<span class="tag">
|
||||
<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i> {{ . }}</a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
<section>
|
||||
{{- with .Params.tags -}}
|
||||
{{- range . -}}
|
||||
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>{{ . }}</a></span>
|
||||
<span class="tag">
|
||||
<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i> {{ . }}</a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</section>
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
{{- $author := .Site.Author.name -}}
|
||||
{{- if isset .Params "author" -}}
|
||||
{{- $author = .Site.Author.name -}}
|
||||
{{- end }}
|
||||
{{- $author := .Params.author | default .Site.Author.name -}}
|
||||
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
|
||||
|
||||
<article class="warpper">
|
||||
<h1 class="post-title animated flipInX">{{ .Title }}</h1>
|
||||
|
||||
<div class="post-meta">
|
||||
<div class="post-meta-main">
|
||||
<a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle fa-fw"></i>{{ $author }} </a>
|
||||
<a class="author" href="{{ $author_link }}" rel="author" target="_blank">
|
||||
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}
|
||||
</a>
|
||||
{{- with .Params.categories -}}
|
||||
<span class="post-category">
|
||||
{{- T "included" -}}
|
||||
{{- T "included" -}}
|
||||
{{- range . -}}
|
||||
{{- $name := . -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
|
||||
@@ -47,8 +47,8 @@
|
||||
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
|
||||
<div class="post-toc" id="post-toc">
|
||||
<h2 class="post-toc-title">{{ T "toc" }}</h2>
|
||||
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
|
||||
<div class="post-toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}">
|
||||
{{- $globalAutoCollapseToc := .Site.Params.auto_collapse_toc | default true }}
|
||||
<div class="post-toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.auto_collapse_toc false)) }} always-active{{ end }}">
|
||||
{{- .TableOfContents -}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,17 +81,21 @@
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<sup>\[return\]</sup>` -}}
|
||||
{{- $REout = printf "<sup>[%s]</sup>" (T "return") -}}
|
||||
{{- $REout = `↩︎` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
|
||||
{{- $REin = `<(.+?) (id="fnref:.+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
||||
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $content | safeHTML -}}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<h2 class="post-title animated pulse faster">
|
||||
{{- $taxonomy := .Data.Singular -}}
|
||||
{{- 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" -}}
|
||||
<i class="fas fa-tag fa-fw"></i>{{ .Title }}
|
||||
<i class="fas fa-tag fa-fw"></i> {{ .Title }}
|
||||
{{- else -}}
|
||||
{{- printf "%s - %s" (T $taxonomy | default (humanize $taxonomy)) .Title -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
{{- $pages := .Pages -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) -}}
|
||||
<div class="card-item">
|
||||
<div class="categories">
|
||||
<a href="{{ .Permalink }}">
|
||||
<h3><i class="far fa-folder fa-fw"></i>{{ $term | humanize}}</h3>
|
||||
</a>
|
||||
<div class="card-item-wrapper">
|
||||
<h3 class="card-item-title">
|
||||
<a href="{{ .Permalink }}">
|
||||
<i class="far fa-folder fa-fw"></i> {{ $term | humanize}}
|
||||
</a>
|
||||
</h3>
|
||||
{{- range first 5 $pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .Permalink }}" class="archive-item-link">
|
||||
|
||||
Reference in New Issue
Block a user