mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
theme: make alias pages usable by file:// protocol #398
This commit is contained in:
parent
573fd99482
commit
99fe90f9b2
2 changed files with 20 additions and 2 deletions
14
layouts/alias.html
Normal file
14
layouts/alias.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ site.LanguageCode | default site.Language.Lang | default "en" }}" dir="{{ T "Reading-direction" | default "ltr" }}">
|
||||
<head>
|
||||
{{- $url := replace (replace .Permalink site.BaseURL "/") "//" "/" }}
|
||||
{{- $url = partial "relLangPrettyUglyURL.hugo" (dict "link" $url) }}
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta http-equiv="refresh" content="0; url={{ $url }}">
|
||||
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
|
||||
<title>{{ $url }}</title>
|
||||
|
||||
{{ (printf $link $url "canonical" "text/html" ($url | htmlEscape)) | safeHTML }}
|
||||
</head>
|
||||
</html>
|
|
@ -1,9 +1,13 @@
|
|||
{{- $to := .to }}
|
||||
{{- $abs := .abs }}
|
||||
{{- $basename := .basename }}
|
||||
{{- $link := $to.RelPermalink }}
|
||||
{{- if $abs }}
|
||||
{{- $link := "" }}
|
||||
{{- if isset . "link" }}
|
||||
{{- $link = .link }}
|
||||
{{- else if $abs }}
|
||||
{{- $link = $to.Permalink }}
|
||||
{{- else }}
|
||||
{{- $link = $to.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- if not $basename }}
|
||||
{{- $basename = "index" }}
|
||||
|
|
Loading…
Reference in a new issue