Merge pull request #44 from CaiJimmy/refactor-rel-permalink

refactor: use relative link for hyperlinks
This commit is contained in:
Jimmy Cai 2020-10-31 23:28:28 +01:00 committed by GitHub
commit c3b3c2f0ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 10 deletions

View file

@ -19,7 +19,7 @@
{{ range $filtered.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }}
<div class="archives-group" id="{{ $id }}">
<h2 class="archives-date section-title"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h2>
<h2 class="archives-date section-title"><a href="{{ $.RelPermalink }}#{{ $id }}">{{ .Key }}</a></h2>
<div class="article-list--compact">
{{ range .Pages }}
{{ partial "article-list/compact" . }}

View file

@ -1,5 +1,5 @@
<article>
<a href="{{ .Permalink }}">
<a href="{{ .RelPermalink }}">
<div class="article-details">
<h2 class="article-title">
{{- .Title -}}

View file

@ -2,7 +2,7 @@
<article class="{{ if $image.exists }}has-image{{ end }}">
{{ if $image.exists }}
<div class="article-image">
<a href="{{ .Permalink }}">
<a href="{{ .RelPermalink }}">
{{ if $image.resource }}
{{- $thumbnail := $image.resource.Fill "800x250" -}}
{{- $thumbnailRetina := $image.resource.Fill "1600x500" -}}

View file

@ -1,6 +1,6 @@
{{ $image := partialCached "helper/image" (dict "Context" .context "Type" .Type) .context.RelPermalink .Type }}
<article class="{{ if $image.exists }}has-image{{ end }}">
<a href="{{ .context.Permalink }}">
<a href="{{ .context.RelPermalink }}">
{{ if $image.exists }}
<div class="article-image">

View file

@ -7,7 +7,7 @@
{{ if and $image.exists $image.resource }}
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $20x := $imageRaw.Fill "20x20 smart" -}}
<a href="{{ .Permalink }}"
<a href="{{ .RelPermalink }}"
class="color-tag"
data-image="{{ $20x.RelPermalink }}"
data-key="{{ $context.Slug }}"
@ -15,14 +15,14 @@
{{ .LinkTitle }}
</a>
{{ else }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{ end }}
{{ end }}
</header>
{{ end }}
<h2 class="article-title">
<a href="{{ .Permalink }}">
<a href="{{ .RelPermalink }}">
{{- .Title -}}
</a>
</h2>

View file

@ -1,7 +1,7 @@
{{ if .Params.Tags }}
<section class="article-tags">
{{ range (.GetTerms "tags") }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{ end }}
</section>
{{ end }}

View file

@ -31,7 +31,7 @@
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
<li {{ if $active }} class='current' {{ end }}>
<a href='{{ .URL | absLangURL }}'>
<a href='{{ .URL | relURL }}'>
{{ if .Pre }}
{{ partial "helper/icon" .Pre }}
{{ end }}

View file

@ -6,7 +6,7 @@
<div class="tagCloud-tags">
{{ range first .Site.Params.widgets.tagCloud.limit .Site.Taxonomies.tags.ByCount }}
<a href="{{ .Page.Permalink }}" class="font_size_{{ .Count }}">
<a href="{{ .Page.RelPermalink }}" class="font_size_{{ .Count }}">
{{ .Page.Title }}
</a>
{{ end }}