38625-vm/post.php
Flatlogic Bot b8a5b3c462 1
2026-02-20 11:14:19 +00:00

78 lines
3.0 KiB
PHP

<?php
require_once 'db/config.php';
$slug = $_GET['slug'] ?? '';
$db = db();
$stmt = $db->prepare("SELECT * FROM posts WHERE slug = ?");
$stmt->execute([$slug]);
$post = $stmt->fetch();
if (!$post) {
header("Location: index.php");
exit;
}
$projectName = $_SERVER['PROJECT_NAME'] ?? 'Our Blog';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?= htmlspecialchars($post['title']) ?> | <?= htmlspecialchars($projectName) ?></title>
<meta name="description" content="<?= htmlspecialchars($post['summary']) ?>" />
<meta property="og:title" content="<?= htmlspecialchars($post['title']) ?> | <?= htmlspecialchars($projectName) ?>" />
<meta property="og:description" content="<?= htmlspecialchars($post['summary']) ?>" />
<meta property="og:image" content="<?= htmlspecialchars($post['image_url']) ?>" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:title" content="<?= htmlspecialchars($post['title']) ?> | <?= htmlspecialchars($projectName) ?>" />
<meta property="twitter:description" content="<?= htmlspecialchars($post['summary']) ?>" />
<meta property="twitter:image" content="<?= htmlspecialchars($post['image_url']) ?>" />
<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&family=Outfit:wght@500;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>">
</head>
<body class="post-detail">
<div class="bg-shapes">
<canvas id="bg-canvas"></canvas>
<div class="shape shape-1" data-speed="2"></div>
<div class="shape shape-2" data-speed="-1.5"></div>
<div class="shape shape-mouse"></div>
</div>
<header>
<div class="container nav">
<a href="index.php" class="logo"><?= htmlspecialchars($projectName) ?></a>
<div class="nav-links">
<a href="index.php">Home</a>
<a href="admin/index.php">Admin</a>
</div>
</div>
</header>
<main>
<article class="container">
<div style="text-align: center; margin-bottom: 3rem; margin-top: 1rem;">
<div class="post-card-date" style="font-size: 1rem; margin-bottom: 1rem;"><?= date('F j, Y', strtotime($post['created_at'])) ?></div>
<h1><?= htmlspecialchars($post['title']) ?></h1>
<p class="subtitle"><?= htmlspecialchars($post['summary']) ?></p>
</div>
<?php if ($post['image_url']): ?>
<div class="hero-image" style="background-image: url('<?= htmlspecialchars($post['image_url']) ?>');"></div>
<?php endif; ?>
<div class="post-content">
<?= $post['content'] ?>
</div>
</article>
</main>
<footer>
<div class="container">
<p>&copy; <?= date('Y') ?> <?= htmlspecialchars($projectName) ?>. Built with Flatlogic AI.</p>
</div>
</footer>
<script src="assets/js/main.js?v=<?= time() ?>"></script>
</body>
</html>