fix some js bugs

This commit is contained in:
geekifan
2025-04-22 11:09:07 +08:00
parent 7b3255f7d4
commit b7f3f54f72
5 changed files with 12 additions and 10 deletions

View File

@ -136,3 +136,5 @@ class Theme {
Theme.init();
export default Theme;
window.Theme = Theme;

View File

@ -9,7 +9,7 @@
{{ $style := $sass | toCSS $opts | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
</head>
<html>
<html lang="{{ .Site.LanguageCode }}">
{{ partial "head.html" . }}
<body>
{{ partial "sidebar.html" . }}

View File

@ -1,5 +1,5 @@
{{ define "main" }}
{{ $enable_toc := and (.Params.toc | default .Site.Params.enableTOC) (gt (len .TableOfContents) 100) }}
{{ $enable_toc := and (.Params.toc | default site.Params.toc) (gt (len .TableOfContents) 100) }}
{{ $lang := .Site.Language.Lang }}
<article class="px-1" data-toc="{{ $enable_toc }}">

View File

@ -80,7 +80,7 @@
<link rel="stylesheet" href="{{ $data.fontawesome.css | relURL }}">
<!-- 3rd-party Dependencies -->
{{ if and site.Params.toc .Params.toc }}
{{ if .Params.toc | default site.Params.toc }}
<link rel="stylesheet" href="{{ $data.toc.css | relURL }}">
{{ end }}

View File

@ -16,7 +16,7 @@
<!-- layout specified -->
{{ if or (eq .Type "post") (eq .Type "page") $is_home }}
{{ if or (eq .Layout "post") (eq .Layout "page") $is_home }}
{{ with $data.lazyPolyfill.js }}
{{ $urls = $urls | append . }}
{{ end }}
@ -32,7 +32,7 @@
{{ end }}
{{ end }}
{{ if or $is_home (eq .Type "post") (eq .Type "archives") (eq .Type "category") (eq .Type "tag") }}
{{ if or $is_home (eq .Layout "post") (eq .Layout "archives") (eq .Layout "category") (eq .Layout "tag") }}
{{ $locale := strings.TrimSuffix (path.Ext .Lang) .Lang }}
{{ with $data.dayjs.js.common }}
@ -70,13 +70,13 @@
{{ $js := "commons" }}
{{ if $is_home }}
{{ $js = "home" }}
{{ else if eq .Type "categories" }}
{{ else if eq .Layout "categories" }}
{{ $js = "categories" }}
{{ else if eq .Type "post" }}
{{ else if eq .Layout "post" }}
{{ $js = "post" }}
{{ else if eq .Type "page" }}
{{ else if eq .Layout "page" }}
{{ $js = "page" }}
{{ else if or (eq .Type "archives") (eq .Type "category") (eq .Type "tag") }}
{{ else if or (eq .Layout "archives") (eq .Layout "category") (eq .Layout "tag") }}
{{ $js = "misc" }}
{{ end }}
@ -93,7 +93,7 @@
{{ end }}
<!-- Pageviews -->
{{ if eq .Type "post" }}
{{ if eq .Layout "post" }}
{{ $provider := site.Params.pageviews.provider }}
{{ if and $provider (ne $provider "") }}
{{ if eq $provider "goatcounter" }}