66 lines
3.6 KiB
PHP
66 lines
3.6 KiB
PHP
<?php
|
|
use App\Content\View;
|
|
use App\Content\Assets;
|
|
use App\Content\CanvasStyle;
|
|
use App\Content\DesignLibrary;
|
|
|
|
$e = View::escape(...);
|
|
$canonical = $path !== null && empty($previewMode) ? View::absolute($path) : null;
|
|
$imageUrl = !empty($socialImage) ? Assets::url($socialImage, $cdn) : '';
|
|
if (str_starts_with($imageUrl, '/')) {
|
|
$imageUrl = View::absolute($imageUrl);
|
|
}
|
|
$theme = $page['theme'] ?? '';
|
|
$palette = DesignLibrary::find((int) ($page['palette_id'] ?? 0), 'palette');
|
|
$showHeader = $page['visibility']['header'] ?? true;
|
|
$showFooter = $page['visibility']['footer'] ?? true;
|
|
?>
|
|
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= $e($title) ?></title>
|
|
<link rel="icon" href="<?= $e(Assets::DEFAULT_ICON) ?>" type="image/webp">
|
|
<meta name="description" content="<?= $e($description) ?>">
|
|
<meta name="theme-color" content="#f5f7fb">
|
|
<?php if ($canonical): ?>
|
|
<link rel="canonical" href="<?= $e($canonical) ?>">
|
|
<meta property="og:url" content="<?= $e($canonical) ?>">
|
|
<?php endif ?>
|
|
<?php if (!empty($noindex)): ?><meta name="robots" content="noindex"><?php endif ?>
|
|
<meta property="og:type" content="<?= isset($article) ? 'article' : 'website' ?>">
|
|
<meta property="og:locale" content="zh_CN">
|
|
<meta property="og:site_name" content="<?= $e($site['name']) ?>">
|
|
<meta property="og:title" content="<?= $e($title) ?>">
|
|
<meta property="og:description" content="<?= $e($description) ?>">
|
|
<?php if ($imageUrl !== ''): ?>
|
|
<meta property="og:image" content="<?= $e($imageUrl) ?>">
|
|
<meta property="og:image:alt" content="<?= $e($socialAlt ?? '') ?>">
|
|
<?php endif ?>
|
|
<?php if (isset($article)): ?>
|
|
<meta property="article:published_time" content="<?= $e(View::date($article['published_at'], DATE_ATOM)) ?>">
|
|
<meta property="article:modified_time" content="<?= $e(View::date($article['updated_at'], DATE_ATOM)) ?>">
|
|
<?php endif ?>
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<link rel="stylesheet" href="/assets/site.css">
|
|
<?php if (!empty($canvas) || str_contains($content . ($headerMarkup ?? '') . ($footerMarkup ?? ''), 'studio-style-')): ?><link rel="stylesheet" href="<?= $e(CanvasStyle::stylesheetUrl()) ?>"><?php endif ?>
|
|
<?php if ($theme !== ''): ?><link rel="stylesheet" href="/assets/page-themes.css"><?php endif ?>
|
|
<?php if ($palette): ?><link rel="stylesheet" data-page-palette href="/palette/<?= $e($palette['id']) ?>.css?v=<?= $e($palette['version']) ?>"><?php endif ?>
|
|
<script src="<?= $e(Assets::JQUERY) ?>" defer></script>
|
|
<script src="/assets/site.js" defer></script>
|
|
</head>
|
|
<body>
|
|
<a class="skip-link" href="#main-content">跳到内容</a>
|
|
<?php if (empty($page['layout_kind']) && ($showHeader || !empty($canvas))): ?>
|
|
<?php if (isset($headerMarkup)): ?><div role="banner" data-site-area="header"<?= $showHeader ? '' : ' hidden' ?>><?= $headerMarkup ?></div>
|
|
<?php else: ?><?= View::fragment('header', compact('header', 'site', 'showHeader', 'visitor', 'member', 'path')) ?><?php endif ?>
|
|
<?php endif ?>
|
|
<main id="main-content"<?= $theme !== '' ? ' class="page-theme theme-' . $e($theme) . '"' : '' ?> tabindex="-1"><?= $content ?></main>
|
|
<?php if (empty($page['layout_kind']) && ($showFooter || !empty($canvas))): ?>
|
|
<?php if (isset($footerMarkup)): ?><div id="contact" role="contentinfo" data-site-area="footer"<?= $showFooter ? '' : ' hidden' ?>><?= $footerMarkup ?></div>
|
|
<?php else: ?><?= View::fragment('footer', compact('footer', 'site', 'showFooter')) ?><?php endif ?>
|
|
<?php endif ?>
|
|
</body>
|
|
</html>
|