-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathheader.php
More file actions
97 lines (97 loc) · 4.76 KB
/
header.php
File metadata and controls
97 lines (97 loc) · 4.76 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, width=device-width"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="dns-prefetch" href="https://at.alicdn.com">
<link rel="dns-prefetch" href="https://weavatar.com">
<link rel="dns-prefetch" href="https://cncdn.cc">
<?php if (!empty($this->options->dnsPrefetch)):
$domains = array_filter(array_map('trim', explode("\n", $this->options->dnsPrefetch)));
foreach ($domains as $domain): ?>
<link rel="dns-prefetch" href="<?php echo $domain; ?>">
<?php endforeach; ?>
<?php endif; ?>
<?php if (!empty($this->options->Favicon)):?>
<link rel="shortcut icon" href="<?php echo $this->options->Favicon; ?>" type="image/x-icon" />
<?php endif; ?>
<title>
<?php if ($this->is('index')): ?>
<?php $this->options->title(); ?> - <?php echo !empty($this->options->slogan) ? $this->options->slogan() : '自豪地使用OneBlog主题'; ?>
<?php elseif($this->is('archive') && isset($this->request->year)): ?>
<?php echo $this->request->year; ?>年发布的文章 - <?php $this->options->title(); ?>
<?php else:?>
<?php if ($this->is('post')): ?>
<?php echo $this->row['title']; ?> - <?php $this->options->title(); ?>
<?php else: ?>
<?php $this->archiveTitle([
'category' => _t('%s'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
], '', ' - '); ?><?php $this->options->title(); ?>
<?php endif; ?>
<?php endif; ?>
</title>
<link href="https://cncdn.cc/animate.css/4.1.1/animate.min.css" rel="stylesheet"><!--动画效果-->
<link href="//at.alicdn.com/t/c/font_3940454_lp08yxn46sl.css" rel="stylesheet"/><!---图标库 iconfont.cn -->
<?php if ($this->is('index')):?>
<link rel="stylesheet" href="https://cncdn.cc/swiper/8.3.2/swiper-bundle.min.css" /><!--轮播图-->
<?php endif;?>
<link rel="stylesheet" href="https://cncdn.cc/@fancyapps/fancybox/3.5.7/dist/jquery.fancybox.min.css" /><!--灯箱效果-->
<link href="https://cncdn.cc/oneblog/3.6.5/main.css" rel="stylesheet"/><!--主题核心样式-->
<link href="https://cncdn.cc/oneblog/3.6.5/m.css" rel="stylesheet"/><!--主题核心样式-->
<style>
:root {
--theme-color: <?php $color = $this->options->themeColor;echo $color ? $color : '#ff5050';?>;
}
<?php echo $this->options->CSS;?>
</style>
<!--各页面OG信息及SEO优化-->
<?php $NoPostIMG = $this->options->NoPostIMG ? $this->options->NoPostIMG : Helper::options()->themeUrl . '/static/img/bg.jpg';
$Webthumb = $this->options->Webthumb ? $this->options->Webthumb : Helper::options()->themeUrl . '/static/img/logo.png';
?>
<!--首页-->
<?php if ($this->is('index')): ?>
<meta property="og:description" content="<?php echo $this->options->description(); ?>" />
<meta property="og:image" content="<?php echo $Webthumb; ?>" />
<meta name="image" content="<?php echo $Webthumb; ?>">
<link rel="apple-touch-icon-precomposed" href="<?php echo $Webthumb; ?>">
<meta name="msapplication-TileImage" content="<?php echo $Webthumb; ?>">
<!--文章详情页-->
<?php elseif ($this->is('post')):
$thumb = showThumbnail($this);?>
<meta property="og:description" content="<?php echo $this->excerpt(80,'...'); ?>" />
<meta property="og:image" content="<?php echo $thumb; ?>" />
<meta name="image" content="<?php echo $thumb; ?>">
<link rel="apple-touch-icon-precomposed" href="<?php echo $thumb; ?>">
<meta name="msapplication-TileImage" content="<?php echo $thumb; ?>">
<!--其他页面-->
<?php else:?>
<meta property="og:image" content="<?php echo $Webthumb; ?>" />
<meta property="og:image:type" content="image/webp">
<meta name="image" content="<?php echo $Webthumb; ?>">
<link rel="apple-touch-icon-precomposed" href="<?php echo $Webthumb; ?>">
<meta name="msapplication-TileImage" content="<?php echo $Webthumb; ?>">
<?php endif;?>
<script>
var logoUrl = "<?php echo $this->options->logo ? $this->options->logo : Helper::options()->themeUrl . '/static/img/logo.svg'; ?>";
var logoWhiteUrl = "<?php echo $this->options->logoWhite ? $this->options->logoWhite : Helper::options()->themeUrl . '/static/img/logoWhite.svg'; ?>";
var bannerSwitch = "<?php echo $this->options->switch; ?>";
(function() {
var currentTheme = document.cookie.replace(/(?:(?:^|.*;\s*)eyeProtectMode\s*\=\s*([^;]*).*$)|^.*$/, "$1");
if (currentTheme === 'dark') {
document.documentElement.classList.add('night');
}
})();
</script>
<?php $this->header();?>
</head>
<body>
<?php $hasLoaded = !empty($_COOKIE['jsLoaded']); ?>
<div id="global-loading" style="display:<?php echo $hasLoaded ? 'none' : 'flex'; ?>;">
<div class="progress-loader">
<div class="progress"></div>
</div>
</div>
<div id="main" style="display:<?php echo $hasLoaded ? '' : 'none'; ?>;">