feat(config): add config for default theme light/dark
This commit is contained in:
@@ -16,7 +16,11 @@
|
||||
<body>
|
||||
{{- /* Check theme isDark before body rendering */ -}}
|
||||
<script>
|
||||
window.isDark = (window.localStorage && window.localStorage.getItem('theme')) === 'dark';
|
||||
if (!window.localStorage || !window.localStorage.getItem('theme')) {
|
||||
window.isDark = '{{ .Site.Params.defaultTheme }}' === 'dark';
|
||||
} else {
|
||||
window.isDark = (window.localStorage && window.localStorage.getItem('theme')) === 'dark';
|
||||
}
|
||||
window.isDark && document.body.classList.add('dark-theme');
|
||||
</script>
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.Social.Mastodon}}
|
||||
{{ $MastodonPrefix := $.Site.Params.Social.MastodonPrefix | default "https://mastodon.social/" }}
|
||||
{{- $MastodonPrefix := $.Site.Params.Social.MastodonPrefix | default "https://mastodon.social/" -}}
|
||||
<a href="{{ $MastodonPrefix | safeURL }}{{ . }}" rel="me noopener noreffer" target="_blank">
|
||||
<i class="fab fa-mastodon fa-fw" title="Mastodon"></i>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user