-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayout.html.php
More file actions
124 lines (113 loc) · 5 KB
/
Copy pathlayout.html.php
File metadata and controls
124 lines (113 loc) · 5 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<?php
$leftBrandTitle = trim(strip_tags((string) blog_title()));
$leftBrandWords = preg_split('/\s+/', $leftBrandTitle, -1, PREG_SPLIT_NO_EMPTY);
$leftInitial = static function ($value, $length = 1) {
return function_exists('mb_substr') ? mb_substr($value, 0, $length, 'UTF-8') : substr($value, 0, $length);
};
if (count($leftBrandWords) >= 2) {
$leftBrandInitials = $leftInitial($leftBrandWords[0]) . $leftInitial($leftBrandWords[count($leftBrandWords) - 1]);
} else {
$leftBrandInitials = $leftInitial($leftBrandTitle, 2);
}
$leftBrandInitials = strtoupper($leftBrandInitials ?: 'HT');
// Asset URL with a cache-buster derived from the file itself.
//
// Until 1.1.3 the buster was a version label written by hand - ?v=5.3.0,
// ?v=1.1.1 - and labels drift away from the files they name. 1.1.2 replaced the
// bundled Marx with 5.3.2 but left the label at ?v=5.3.0, so anyone who had
// already cached that stylesheet went on being served Marx 5.3.0 and none of
// the release reached them. Nothing in the theme could notice, because the two
// values had no connection to each other.
//
// A file's modification time has that connection by construction: it changes
// when the file changes, keeps the URL stable when it does not (so caching
// still works), and cannot claim a version the file does not have. There is
// nothing left to remember at release time.
$leftAsset = static function ($path) {
$file = __DIR__ . '/' . $path;
return is_file($file)
? theme_path() . $path . '?v=' . filemtime($file)
: theme_path() . $path;
};
?>
<!DOCTYPE html>
<html lang="<?php echo blog_language(); ?>">
<head>
<meta name="theme-color" content="#b91c1c">
<?php echo head_contents(); ?>
<?php if (isset($metatags)) echo $metatags; ?>
<link rel="stylesheet" href="<?php echo $leftAsset('css/marx.min.css'); ?>">
<link rel="stylesheet" href="<?php echo $leftAsset('css/style.css'); ?>">
</head>
<body<?php if (!empty($bodyclass)): ?> class="<?php echo $bodyclass; ?>"<?php endif; ?> itemscope="itemscope" itemtype="https://schema.org/Blog">
<div class="visually-hidden" aria-hidden="true">
<meta content="<?php echo safe_html(strip_tags(blog_title())); ?>" itemprop="name">
<meta content="<?php echo safe_html(strip_tags(blog_description())); ?>" itemprop="description">
</div>
<?php if (facebook()) echo facebook(); ?>
<?php if (login()) toolbar(); ?>
<header class="left-site-header">
<div class="left-banner" aria-hidden="true"><span>★</span><span>★</span><span>★</span></div>
<div class="left-nav left-width">
<a class="left-brand" rel="home" href="<?php echo site_url(); ?>" aria-label="<?php echo safe_html(strip_tags(blog_title())); ?>">
<span class="left-brand-initials"><?php echo safe_html($leftBrandInitials); ?></span>
</a>
<button class="left-menu-button" type="button" data-left-menu-button aria-expanded="false" aria-controls="left-navigation"><?php echo i18n('Menu'); ?></button>
<div class="site-navigation-wrap" id="left-navigation" data-left-navigation>
<nav class="site-nav" aria-label="Primary navigation">
<?php echo menu(); ?>
</nav>
<div class="site-search" role="search">
<?php echo search(); ?>
</div>
</div>
</div>
</header>
<main id="content" class="left-main left-width">
<?php echo content(); ?>
</main>
<?php if (theme_config('recent_posts') || theme_config('popular_posts') || theme_config('archive') || theme_config('category_list') || theme_config('tagcloud')): ?>
<aside class="site-widgets left-width" aria-label="Blog widgets">
<?php if (theme_config('recent_posts')): ?>
<section class="widget">
<h2><?php echo i18n('Recent_posts'); ?></h2>
<?php echo recent_posts(); ?>
</section>
<?php endif; ?>
<?php if (theme_config('popular_posts')): ?>
<section class="widget">
<h2><?php echo i18n('popular_posts'); ?></h2>
<?php echo popular_posts(); ?>
</section>
<?php endif; ?>
<?php if (theme_config('archive')): ?>
<section class="widget">
<h2><?php echo i18n('Archives'); ?></h2>
<?php echo archive_list(); ?>
</section>
<?php endif; ?>
<?php if (theme_config('category_list')): ?>
<section class="widget">
<h2><?php echo i18n('Category'); ?></h2>
<?php echo category_list(); ?>
</section>
<?php endif; ?>
<?php if (theme_config('tagcloud')): ?>
<section class="widget">
<h2><?php echo i18n('Tags'); ?></h2>
<div class="tag-cloud"><?php echo tag_cloud(); ?></div>
</section>
<?php endif; ?>
</aside>
<?php endif; ?>
<footer class="left-footer">
<div class="left-width left-footer-inner">
<?php if (function_exists('social')): ?><div class="site-social"><?php echo social(); ?></div><?php endif; ?>
<div class="site-copyright">🄯 <?php echo blog_title(); ?> · Powered by <a class="htmly-footer-link" href="https://github.com/danpros/htmly" target="_blank" rel="noopener noreferrer">HTMLy</a></div>
</div>
</footer>
<script src="<?php echo $leftAsset('js/theme.js'); ?>"></script>
<?php if (analytics()): ?><?php echo analytics(); ?><?php endif; ?>
</body>
</html>