fix(link): fix tags/categories link bug

This commit is contained in:
Dillon
2020-02-21 12:49:55 +08:00
parent a4116f14a7
commit a0f31c35fe
7 changed files with 48 additions and 35 deletions

View File

@@ -6,8 +6,8 @@
line-height: 3rem; line-height: 3rem;
} }
.meta { .post-meta {
font-size: .88rem; font-size: .875rem;
color: $global-font-secondary-color; color: $global-font-secondary-color;
span { span {

View File

@@ -30,8 +30,7 @@
font-size: 1.6rem; font-size: 1.6rem;
} }
.meta { .post-meta {
font-size: .875rem !important;
a { a {
color: $global-font-secondary-color !important; color: $global-font-secondary-color !important;

View File

@@ -13,25 +13,30 @@
</h1> </h1>
{{- /* Meta */ -}} {{- /* Meta */ -}}
<div class="meta"> <div class="post-meta">
{{- $author := .Params.author | default .Site.Author.name -}} {{- $author := .Params.author | default .Site.Author.name -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}} {{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<a class="author" href="{{ $authorLink }}" rel="author" target="_blank"> <span class="post-author">
<i class="fas fa-user-circle fa-fw"></i>{{ $author }} <a class="author" href="{{ $authorLink }}" rel="author" target="_blank">
</a> <i class="fas fa-user-circle fa-fw"></i>{{ $author }}
</a>
</span>
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}} {{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
{{ T "publish" }} <time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp; &nbsp;<span class="post-publish">
{{ T "publish" }}&nbsp;<time datetime={{ $publish_date }}>{{ $publish_date }}</time>
</span>
{{- with .Params.categories -}} {{- with .Params.categories -}}
<span class="post-category"> &nbsp;<span class="post-category">
{{- T "included" -}}&nbsp; {{- T "included" -}}
{{- range . -}} {{- range . -}}
{{- $name := . -}} &nbsp;
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} <span>
<i class="far fa-folder fa-fw"></i> <a href="{{ `/categories/` | relLangURL }}{{ urlize .}}">
<a href="{{ .Permalink }}">{{ $name | humanize }}</a> <i class="far fa-folder fa-fw"></i>{{ . | humanize }}
{{- end -}} </a>
</span>
{{- end -}} {{- end -}}
</span> </span>
{{- end -}} {{- end -}}
@@ -48,8 +53,10 @@
{{- with .Params.tags -}} {{- with .Params.tags -}}
<div class="post-tags"> <div class="post-tags">
{{- range . -}} {{- range . -}}
<span class="tag"> &nbsp;<span>
&nbsp;<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>&nbsp;{{ . }}</a> <a href="{{ `/tags/` | relLangURL }}{{ urlize .}}">
<i class="fas fa-tag fa-fw"></i>{{ . }}
</a>
</span> </span>
{{- end -}} {{- end -}}
</div> </div>

View File

@@ -35,7 +35,7 @@
<div class="menu" id="menu-mobile"> <div class="menu" id="menu-mobile">
{{- $currentPage := . -}} {{- $currentPage := . -}}
{{- range .Site.Menus.main -}} {{- range .Site.Menus.main -}}
<a class="menu-item" href="{{ .URL | absLangURL }}" title="{{ .Title }}"> <a class="menu-item" href="{{ .URL | relLangURL }}" title="{{ .Title }}">
{{- .Pre | safeHTML }}{{ .Name -}} {{- .Pre | safeHTML }}{{ .Name -}}
</a> </a>
{{- end -}} {{- end -}}

View File

@@ -41,9 +41,11 @@
<section> <section>
{{- with .Params.tags -}} {{- with .Params.tags -}}
{{- range . -}} {{- range . -}}
<span class="tag"> <span>
<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>&nbsp;{{ . }}</a>&nbsp; <a href="{{ `/tags/` | relLangURL }}{{ urlize .}}">
</span> <i class="fas fa-tag fa-fw"></i>{{ . }}
</a>
</span>&nbsp;
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</section> </section>

View File

@@ -6,26 +6,31 @@
<h1 class="single-title animated flipInX">{{ .Title }}</h1> <h1 class="single-title animated flipInX">{{ .Title }}</h1>
{{- /* Meta */ -}} {{- /* Meta */ -}}
<div class="meta"> <div class="post-meta">
<div class="meta-line"> <div class="post-meta-line">
{{- $author := .Params.author | default .Site.Author.name -}} {{- $author := .Params.author | default .Site.Author.name -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}} {{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<a class="author" href="{{ $authorLink }}" rel="author" target="_blank"> <span class="post-author">
<i class="fas fa-user-circle fa-fw"></i>{{ $author }} <a class="author" href="{{ $authorLink }}" rel="author" target="_blank">
</a>&nbsp; <i class="fas fa-user-circle fa-fw"></i>{{ $author }}
</a>
</span>
{{- with .Params.categories -}} {{- with .Params.categories -}}
<span class="post-category"> &nbsp;<span class="post-category">
{{- T "included" -}}&nbsp; {{- T "included" -}}
{{- range . -}} {{- range . -}}
{{- $name := . -}} &nbsp;
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} <span>
<i class="far fa-folder fa-fw"></i><a href="{{ .Permalink }}">{{ $name | humanize }}</a>&nbsp; <a href="{{ `/categories/` | relLangURL }}{{ urlize .}}">
{{- end -}} <i class="far fa-folder fa-fw"></i>{{ . | humanize }}
</a>
</span>
{{- end -}} {{- end -}}
</span> </span>
{{- end -}} {{- end -}}
</div> </div>
<div class="meta-line"> <div class="post-meta-line">
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}} {{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
<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;
<i class="fas fa-pencil-alt fa-fw"></i>{{ T "wordCount" .WordCount }}&nbsp; <i class="fas fa-pencil-alt fa-fw"></i>{{ T "wordCount" .WordCount }}&nbsp;