refactor: Use RelPermalink for internal links (#1231)

This commit is contained in:
Jimmy
2026-01-25 22:31:58 +01:00
committed by GitHub
parent c872a77edb
commit 633c8c6b9f
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
{{- $searchPage := index $query 0 -}} {{- $searchPage := index $query 0 -}}
{{- with $searchPage -}} {{- with $searchPage -}}
<form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}> <form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .RelPermalink }}" {{- end }}>
<p> <p>
<label>{{ T "search.title" }}</label> <label>{{ T "search.title" }}</label>
<input id="searchInput" name="keyword" required placeholder="{{ T `search.placeholder` }}" /> <input id="searchInput" name="keyword" required placeholder="{{ T `search.placeholder` }}" />
+1 -1
View File
@@ -4,7 +4,7 @@
{{- $result := slice -}} {{- $result := slice -}}
{{- range $filtered -}} {{- range $filtered -}}
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}} {{- $data := dict "title" .Title "date" .Date "permalink" .RelPermalink "content" (.Plain) -}}
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}} {{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
{{- if $image.exists -}} {{- if $image.exists -}}
@@ -56,7 +56,7 @@
{{ partial "helper/icon" "language" }} {{ partial "helper/icon" "language" }}
<div> <div>
{{ range .Translations }} {{ range .Translations }}
<a href="{{ .Permalink }}" class="link">{{ .Language.LanguageName }}</a> <a href="{{ .RelPermalink }}" class="link">{{ .Language.LanguageName }}</a>
{{ end }} {{ end }}
</div> </div>
</footer> </footer>
+1 -1
View File
@@ -83,7 +83,7 @@
{{ partial "helper/icon" "language" }} {{ partial "helper/icon" "language" }}
<select name="language" title="language" onchange="window.location.href = this.selectedOptions[0].value"> <select name="language" title="language" onchange="window.location.href = this.selectedOptions[0].value">
{{ range . }} {{ range . }}
<option value="{{ .Permalink }}" {{ if eq .Language.Lang $currentLanguageCode }}selected{{ end }}>{{ .Language.LanguageName }}</option> <option value="{{ .RelPermalink }}" {{ if eq .Language.Lang $currentLanguageCode }}selected{{ end }}>{{ .Language.LanguageName }}</option>
{{ end }} {{ end }}
</select> </select>
</li> </li>
+1 -1
View File
@@ -1,7 +1,7 @@
{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "search") -}} {{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "search") -}}
{{- if $query -}} {{- if $query -}}
{{- $searchPage := index $query 0 -}} {{- $searchPage := index $query 0 -}}
<form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}> <form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .RelPermalink }}" {{- end }}>
<p> <p>
<label>{{ T "search.title" }}</label> <label>{{ T "search.title" }}</label>
<input name="keyword" required placeholder="{{ T `search.placeholder` }}" /> <input name="keyword" required placeholder="{{ T `search.placeholder` }}" />