| 1 |
<?php |
| 2 |
/** |
| 3 |
* Public page header. Expects $page_title to be optionally set beforehand. |
| 4 |
* |
| 5 |
* Pages may also set $og_title, $og_description and $og_image (an absolute |
| 6 |
* URL — see abs_url()) to control how they unfurl when shared. Repository |
| 7 |
* pages point $og_image at their generated card; anything else falls back to |
| 8 |
* assets/og-default.png when that file exists. |
| 9 |
*/ |
| 10 |
require_once __DIR__ . '/helpers.php'; |
| 11 |
$page_title = $page_title ?? 'Code'; |
| 12 |
|
| 13 |
$og_title = $og_title ?? $page_title; |
| 14 |
$og_description = trim((string) ($og_description ?? '')); |
| 15 |
$og_url = $og_url ?? abs_url(parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?? '/'); |
| 16 |
if (!isset($og_image) && is_readable(__DIR__ . '/../assets/og-default.png')) { |
| 17 |
$og_image = abs_url('/assets/og-default.png'); |
| 18 |
} |
| 19 |
?><!doctype html> |
| 20 |
<html lang="en"> |
| 21 |
<head> |
| 22 |
<meta charset="utf-8"> |
| 23 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 24 |
<title><?= e($page_title) ?></title> |
| 25 |
<?php if ($og_description !== ''): ?> |
| 26 |
<meta name="description" content="<?= e($og_description) ?>"> |
| 27 |
<?php endif; ?> |
| 28 |
<meta property="og:type" content="website"> |
| 29 |
<meta property="og:site_name" content="jefftml's </> code"> |
| 30 |
<meta property="og:title" content="<?= e($og_title) ?>"> |
| 31 |
<meta property="og:url" content="<?= e($og_url) ?>"> |
| 32 |
<?php if ($og_description !== ''): ?> |
| 33 |
<meta property="og:description" content="<?= e($og_description) ?>"> |
| 34 |
<?php endif; ?> |
| 35 |
<?php if (!empty($og_image)): ?> |
| 36 |
<meta property="og:image" content="<?= e($og_image) ?>"> |
| 37 |
<meta property="og:image:width" content="1200"> |
| 38 |
<meta property="og:image:height" content="630"> |
| 39 |
<meta property="og:image:alt" content="<?= e($og_title) ?>"> |
| 40 |
<meta name="twitter:card" content="summary_large_image"> |
| 41 |
<?php endif; ?> |
| 42 |
<link rel="stylesheet" href="<?= e(url('/assets/style.css')) ?>"> |
| 43 |
</head> |
| 44 |
<body> |
| 45 |
<header class="site-header"> |
| 46 |
<div class="wrap"> |
| 47 |
<a class="brand" href="<?= e(url('/')) ?>">jefftml's </> code</a> |
| 48 |
<nav> |
| 49 |
<a href="<?= e(url('/admin/dashboard.php')) ?>">Admin</a> |
| 50 |
</nav> |
| 51 |
</div> |
| 52 |
</header> |
| 53 |
<main class="wrap"> |
| 54 |
|