1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-03-30 10:59:15 +02:00

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
assets/css
_page
_partial/_home
layouts
resources/_gen/assets/scss/css

View file

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

View file

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

View file

@ -13,25 +13,30 @@
</h1>
{{- /* Meta */ -}}
<div class="meta">
<div class="post-meta">
{{- $author := .Params.author | default .Site.Author.name -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<a class="author" href="{{ $authorLink }}" rel="author" target="_blank">
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}
</a>
<span class="post-author">
<a class="author" href="{{ $authorLink }}" rel="author" target="_blank">
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}
</a>
</span>
{{- $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 -}}
<span class="post-category">
{{- T "included" -}}&nbsp;
&nbsp;<span class="post-category">
{{- T "included" -}}
{{- range . -}}
{{- $name := . -}}
{{- 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 | humanize }}</a>
{{- end -}}
&nbsp;
<span>
<a href="{{ `/categories/` | relLangURL }}{{ urlize .}}">
<i class="far fa-folder fa-fw"></i>{{ . | humanize }}
</a>
</span>
{{- end -}}
</span>
{{- end -}}
@ -48,8 +53,10 @@
{{- with .Params.tags -}}
<div class="post-tags">
{{- range . -}}
<span class="tag">
&nbsp;<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag fa-fw"></i>&nbsp;{{ . }}</a>
&nbsp;<span>
<a href="{{ `/tags/` | relLangURL }}{{ urlize .}}">
<i class="fas fa-tag fa-fw"></i>{{ . }}
</a>
</span>
{{- end -}}
</div>

View file

@ -35,7 +35,7 @@
<div class="menu" id="menu-mobile">
{{- $currentPage := . -}}
{{- 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 -}}
</a>
{{- end -}}

View file

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

View file

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