Merge pull request #558 from khusika/schema-fix

Fixes issues #401
This commit is contained in:
Dillon 2022-05-03 16:19:19 +08:00 committed by GitHub
commit 7ff5ef43aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 24 additions and 25 deletions

View file

@ -52,11 +52,11 @@
.page {
width: 100%;
[header-mobile] & {
[data-header-mobile] & {
padding-top: $header-height;
}
[header-mobile=normal] & {
[data-header-mobile=normal] & {
padding-top: 0;
}

View file

@ -66,7 +66,7 @@
}
}
.home[posts] {
.home[data-home=posts] {
.home-profile {
@include transform(translateY(0));
padding-top: 2rem;

View file

@ -4,11 +4,11 @@
width: 60%;
margin: 0 auto;
[header-desktop] & {
[data-header-desktop] & {
padding-top: $header-height;
}
[header-desktop=normal] & {
[data-header-desktop=normal] & {
padding-top: 0;
}

View file

@ -151,7 +151,7 @@ header {
height: $header-height;
line-height: $header-height;
[header-desktop=normal] & {
[data-header-desktop=normal] & {
position: static;
}
@ -216,7 +216,7 @@ header {
height: $header-height;
line-height: $header-height;
[header-mobile=normal] & {
[data-header-mobile=normal] & {
position: static;
}

View file

@ -60,7 +60,7 @@
left: 0;
visibility: hidden;
[header-desktop=normal] & {
[data-header-desktop=normal] & {
top: 5rem;
}
@ -116,7 +116,7 @@
display: none;
margin: .8rem 0;
&[kept=true] {
&[data-kept=true] {
display: block;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noodp" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<title>
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
</title>
@ -15,7 +14,7 @@
{{- partial "head/link.html" . -}}
{{- partial "head/seo.html" . -}}
</head>
<body header-desktop="{{ .Site.Params.header.desktopMode }}" header-mobile="{{ .Site.Params.header.mobileMode }}">
<body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
{{- /* Check theme isDark before body rendering */ -}}
{{- $theme := .Site.Params.defaulttheme -}}
<script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>

View file

@ -3,7 +3,7 @@
{{- $profile := .Site.Params.home.profile -}}
{{- $posts := .Site.Params.home.posts -}}
<div class="page home"{{ if ne $posts.enable false }} posts{{ end }}>
<div class="page home"{{ if ne $posts.enable false }} data-home="posts"{{ end }}>
{{- /* Profile */ -}}
{{- if ne $profile.enable false -}}
{{- partial "home/profile.html" . -}}

View file

@ -17,7 +17,7 @@
</div>
{{- end -}}
<div class="footer-line">
<div class="footer-line" itemscope itemtype="http://schema.org/CreativeWork">
{{- /* Copyright year */ -}}
{{- if ne .Site.Params.footer.copyright false -}}
<i class="far fa-copyright fa-fw"></i>

View file

@ -28,7 +28,7 @@
{{- end -}}
{{- with $profile.subtitle -}}
<h2 class="home-subtitle">
<div class="home-subtitle">
{{- if $profile.typeit -}}
{{- $id := dict "Content" . "Scratch" $.Scratch | partial "function/id.html" -}}
<div id="{{ $id }}" class="typeit"></div>
@ -36,7 +36,7 @@
{{- else -}}
{{- . -}}
{{- end -}}
</h2>
</div>
{{- end -}}
{{- if $profile.social -}}

View file

@ -76,7 +76,7 @@
{{- /* Static TOC */ -}}
{{- if ne $toc.enable false -}}
<div class="details toc" id="toc-static" kept="{{ if $toc.keepStatic }}true{{ end }}">
<div class="details toc" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "contents" }}</span>
<span><i class="details-icon fas fa-angle-right"></i></span>

File diff suppressed because one or more lines are too long

View file

@ -397,7 +397,7 @@ class Theme {
initToc() {
const $tocCore = document.getElementById('TableOfContents');
if ($tocCore === null) return;
if (document.getElementById('toc-static').getAttribute('kept') || this.util.isTocStatic()) {
if (document.getElementById('toc-static').getAttribute('data-kept') || this.util.isTocStatic()) {
const $tocContentStatic = document.getElementById('toc-content-static');
if ($tocCore.parentElement !== $tocContentStatic) {
$tocCore.parentElement.removeChild($tocCore);
@ -419,7 +419,7 @@ class Theme {
const $tocLinkElements = $tocCore.querySelectorAll('a:first-child');
const $tocLiElements = $tocCore.getElementsByTagName('li');
const $headerLinkElements = document.getElementsByClassName('headerLink');
const headerIsFixed = document.body.getAttribute('header-desktop') !== 'normal';
const headerIsFixed = document.body.getAttribute('data-header-desktop') !== 'normal';
const headerHeight = document.getElementById('header-desktop').offsetHeight;
const TOP_SPACING = 20 + (headerIsFixed ? headerHeight : 0);
const minTocTop = $toc.offsetTop;
@ -632,8 +632,8 @@ class Theme {
onScroll() {
const $headers = [];
if (document.body.getAttribute('header-desktop') === 'auto') $headers.push(document.getElementById('header-desktop'));
if (document.body.getAttribute('header-mobile') === 'auto') $headers.push(document.getElementById('header-mobile'));
if (document.body.getAttribute('data-header-desktop') === 'auto') $headers.push(document.getElementById('header-desktop'));
if (document.body.getAttribute('data-header-mobile') === 'auto') $headers.push(document.getElementById('header-mobile'));
if (document.getElementById('comments')) {
const $viewComments = document.getElementById('view-comments');
$viewComments.href = `#comments`;