Skip to content

Commit

Permalink
fix: avoid flickering when redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Nov 15, 2022
1 parent 86bb01a commit 4ebc15a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 1 addition & 4 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<!doctype html>
{{- $color := default "auto" $.Site.Params.color }}
{{- if not (in (slice "light" "dark" "auto") $color) }}
{{- $color = "auto" }}
{{- end }}
{{- $color := partialCached "functions/color" . }}
<html class="position-relative" itemscope itemtype="http://schema.org/WebPage" lang="{{ .Lang }}"
data-bs-theme="{{ $color }}"
{{- with $.Site.Language.LanguageDirection }} dir="{{ . }}"{{ end }}
Expand Down
13 changes: 13 additions & 0 deletions layouts/alias.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
{{- $color := partialCached "functions/color" .Page }}
<html data-bs-theme="{{ $color }}">
<head>
{{- partial "assets/init/js" .Page -}}
{{- partialCached "assets/main/css" .Page }}
<title>{{ .Permalink }}</title>
<link rel="canonical" href="{{ .Permalink }}"/>
<meta name="robots" content="noindex">
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="refresh" content="0; url={{ .Permalink }}"/>
</head>
</html>
5 changes: 5 additions & 0 deletions layouts/partials/functions/color.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{- $color := default "auto" $.Site.Params.color }}
{{- if not (in (slice "light" "dark" "auto") $color) }}
{{- $color = "auto" }}
{{- end }}
{{- return $color -}}

0 comments on commit 4ebc15a

Please sign in to comment.