Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
fix(link): fix tags/categories link bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Feb 21, 2020
1 parent a4116f1 commit a0f31c3
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 35 deletions.
4 changes: 2 additions & 2 deletions assets/css/_page/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
line-height: 3rem;
}

.meta {
font-size: .88rem;
.post-meta {
font-size: .875rem;
color: $global-font-secondary-color;

span {
Expand Down
3 changes: 1 addition & 2 deletions assets/css/_partial/_home/_summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
font-size: 1.6rem;
}

.meta {
font-size: .875rem !important;
.post-meta {
a {
color: $global-font-secondary-color !important;

Expand Down
35 changes: 21 additions & 14 deletions layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,30 @@ <h1 class="single-title" itemprop="name headline">
</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 -}}
Expand All @@ -48,8 +53,10 @@ <h1 class="single-title" itemprop="name headline">
{{- 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>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down
8 changes: 5 additions & 3 deletions layouts/partials/post/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
29 changes: 17 additions & 12 deletions layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

Large diffs are not rendered by default.

0 comments on commit a0f31c3

Please sign in to comment.