39865-vm/partials/header.php
Flatlogic Bot d5ac0af598 beta
2026-05-01 21:45:54 +00:00

66 lines
3.4 KiB
PHP

<?php
declare(strict_types=1);
$pageTitle = isset($pageTitle) ? (string) $pageTitle : '';
$pageDescription = isset($pageDescription) ? (string) $pageDescription : '';
$activeNav = isset($activeNav) ? (string) $activeNav : '';
$toastMessage = isset($toastMessage) ? (string) $toastMessage : '';
$bodyClass = isset($bodyClass) ? (string) $bodyClass : '';
$resolvedDescription = trim($pageDescription !== '' ? $pageDescription : site_description_default());
$resolvedTitle = page_title($pageTitle);
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?= htmlspecialchars($resolvedTitle) ?></title>
<meta name="description" content="<?= htmlspecialchars($resolvedDescription) ?>" />
<meta name="author" content="<?= htmlspecialchars(site_name()) ?>" />
<meta property="og:title" content="<?= htmlspecialchars($resolvedTitle) ?>" />
<meta property="og:description" content="<?= htmlspecialchars($resolvedDescription) ?>" />
<meta property="twitter:title" content="<?= htmlspecialchars($resolvedTitle) ?>" />
<meta property="twitter:description" content="<?= htmlspecialchars($resolvedDescription) ?>" />
<meta name="theme-color" content="#0f172a" />
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="<?= htmlspecialchars(asset_url('assets/css/custom.css')) ?>">
</head>
<body class="<?= htmlspecialchars($bodyClass) ?>"<?php if ($toastMessage !== ''): ?> data-toast-message="<?= htmlspecialchars($toastMessage) ?>"<?php endif; ?>>
<header class="site-header sticky-top">
<nav class="navbar navbar-expand-lg" aria-label="Primary navigation">
<div class="container">
<a class="navbar-brand d-flex align-items-center gap-3" href="/">
<span class="brand-mark"><?= htmlspecialchars(site_initials()) ?></span>
<span>
<span class="brand-name d-block"><?= htmlspecialchars(site_name()) ?></span>
<span class="brand-subtitle d-block">Software engineering & product delivery</span>
</span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#primaryNav" aria-controls="primaryNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="primaryNav">
<ul class="navbar-nav ms-auto mb-3 mb-lg-0 align-items-lg-center gap-lg-2">
<?php foreach (nav_items() as $item): ?>
<li class="nav-item">
<a class="nav-link<?= $activeNav === $item['key'] ? ' active' : '' ?>" href="<?= htmlspecialchars($item['href']) ?>"><?= htmlspecialchars($item['label']) ?></a>
</li>
<?php endforeach; ?>
<li class="nav-item ms-lg-2">
<a class="btn btn-primary btn-sm site-cta" href="/contact.php">Start a project</a>
</li>
</ul>
</div>
</div>
</nav>
</header>