-
Notifications
You must be signed in to change notification settings - Fork 0
/
head.php
55 lines (52 loc) · 2.43 KB
/
head.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="generator" content="Hugo 0.123.8">
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<meta name='description' content="<?php $this->options->description() ?>.">
<title><?php $this->archiveTitle([
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
], '', ' - '); ?><?php $this->options->title(); ?></title>
<link rel='canonical' href='<?php $this->options->siteUrl(); ?>'>
<?php if ($this->options->showmod):?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/mod.css');?>">
<?php else:?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/style.css');?>">
<?php endif;?>
<meta property='og:title' content="<?php $this->options->siteUrl(); ?>">
<meta property='og:description' content="<?php $this->options->description() ?>.">
<meta property='og:url' content='<?php $this->options->siteUrl(); ?>'>
<meta property='og:site_name' content='<?php $this->options->title(); ?>'>
<meta property='og:type' content='website'>
<meta name="twitter:title" content="<?php $this->options->siteUrl(); ?>">
<meta name="twitter:description" content="<?php $this->options->description() ?>.">
<link rel="alternate" type="application/rss+xml" href="<?php $this->options->siteUrl(); ?>feed">
<link rel="shortcut icon" href="<?php $this->options->iconUrl(); ?>" />
<?php $this->options->addhead() ?>
<?php $this->header("generator=&template="); ?>
</head>
<script>
(function() {
const colorSchemeKey = 'StackColorScheme';
if(!localStorage.getItem(colorSchemeKey)){
localStorage.setItem(colorSchemeKey, "auto");
}
})();
</script>
<script>
(function() {
const colorSchemeKey = 'StackColorScheme';
const colorSchemeItem = localStorage.getItem(colorSchemeKey);
const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;
if (colorSchemeItem == 'dark' || colorSchemeItem === 'auto' && supportDarkMode) {
document.documentElement.dataset.scheme = 'dark';
} else {
document.documentElement.dataset.scheme = 'light';
}
})();
</script>