69 lines
3.4 KiB
PHP
69 lines
3.4 KiB
PHP
<?php
|
|
$lang = $lang ?? 'en';
|
|
$site = $site ?? site_config($lang);
|
|
$navItems = $navItems ?? $site['nav'];
|
|
$pageTitle = $pageTitle ?? $site['brand'];
|
|
$pageDescription = $pageDescription ?? '';
|
|
$assetVersion = $assetVersion ?? (string) time();
|
|
$langSwitchUrl = $langSwitchUrl ?? '/zh/index.php';
|
|
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
$metaDescription = $projectDescription !== '' ? $projectDescription : $pageDescription;
|
|
|
|
$whatsAppLink = 'https://wa.me/' . $site['whatsapp_number'] . '?text=' . urlencode($site['whatsapp_message']);
|
|
?>
|
|
<!doctype html>
|
|
<html lang="<?= htmlspecialchars($lang) ?>">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= htmlspecialchars($pageTitle) ?></title>
|
|
<?php if ($metaDescription): ?>
|
|
<meta name="description" content="<?= htmlspecialchars($metaDescription) ?>" />
|
|
<meta property="og:description" content="<?= htmlspecialchars($metaDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= htmlspecialchars($metaDescription) ?>" />
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
<link rel="stylesheet" href="/assets/css/custom.css?v=<?= htmlspecialchars($assetVersion) ?>">
|
|
</head>
|
|
<body>
|
|
<header class="site-header sticky-top">
|
|
<nav class="navbar navbar-expand-lg">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="<?= htmlspecialchars($lang === 'zh' ? '/zh/index.php' : '/index.php') ?>">
|
|
<span class="brand-mark">SH</span>
|
|
<span class="brand-text"><?= htmlspecialchars($site['brand']) ?></span>
|
|
</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#primaryNav">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="primaryNav">
|
|
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
|
<?php foreach ($navItems as $item): ?>
|
|
<li class="nav-item">
|
|
<a class="nav-link px-3" href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['label']) ?></a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<div class="d-flex align-items-center gap-2 ms-lg-3">
|
|
<a class="btn btn-sm btn-outline-secondary" href="<?= htmlspecialchars($langSwitchUrl) ?>"><?= $lang === 'zh' ? 'EN' : '中文' ?></a>
|
|
<a class="btn btn-sm btn-primary" href="<?= htmlspecialchars($whatsAppLink) ?>" target="_blank" rel="noopener">WhatsApp</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<a class="whatsapp-float" href="<?= htmlspecialchars($whatsAppLink) ?>" target="_blank" rel="noopener" aria-label="Chat on WhatsApp">
|
|
<i class="bi bi-whatsapp"></i>
|
|
</a>
|