123 lines
5.9 KiB
PHP
123 lines
5.9 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/site.php';
|
|
|
|
function nav_link_class(string $scriptName): string
|
|
{
|
|
$currentScript = basename((string)($_SERVER['SCRIPT_NAME'] ?? 'index.php'));
|
|
return $currentScript === $scriptName ? 'nav-link active' : 'nav-link';
|
|
}
|
|
|
|
function render_page_start(array $options = []): void
|
|
{
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? getenv('PROJECT_DESCRIPTION') ?: '';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? getenv('PROJECT_IMAGE_URL') ?: '';
|
|
$projectName = $_SERVER['PROJECT_NAME'] ?? getenv('PROJECT_NAME') ?: project_name();
|
|
|
|
$pageTitle = $options['title'] ?? project_name();
|
|
$metaDescription = $options['description'] ?? ($projectDescription !== '' ? $projectDescription : project_description());
|
|
$canonicalUrl = $options['canonical'] ?? current_url();
|
|
$robots = $options['robots'] ?? 'index,follow';
|
|
$keywords = $options['keywords'] ?? 'apknusa, aplikasi android, blog apk, tips android, backlink website';
|
|
$bodyClass = $options['body_class'] ?? '';
|
|
$jsonLd = $options['json_ld'] ?? null;
|
|
$brandName = project_name();
|
|
?>
|
|
<!doctype html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= e($pageTitle) ?></title>
|
|
<meta name="description" content="<?= e($metaDescription) ?>">
|
|
<meta name="robots" content="<?= e($robots) ?>">
|
|
<meta name="keywords" content="<?= e($keywords) ?>">
|
|
<meta name="author" content="<?= e($projectName) ?>">
|
|
<link rel="canonical" href="<?= e($canonicalUrl) ?>">
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:title" content="<?= e($pageTitle) ?>">
|
|
<meta property="og:url" content="<?= e($canonicalUrl) ?>">
|
|
<meta property="og:site_name" content="<?= e($brandName) ?>">
|
|
<meta property="twitter:card" content="summary_large_image">
|
|
<meta property="twitter:title" content="<?= e($pageTitle) ?>">
|
|
<?php if ($metaDescription !== ''): ?>
|
|
<meta property="og:description" content="<?= e($metaDescription) ?>">
|
|
<meta property="twitter:description" content="<?= e($metaDescription) ?>">
|
|
<?php elseif ($projectDescription): ?>
|
|
<meta property="og:description" content="<?= e($projectDescription) ?>">
|
|
<meta property="twitter:description" content="<?= e($projectDescription) ?>">
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= e($projectImageUrl) ?>">
|
|
<meta property="twitter:image" content="<?= e($projectImageUrl) ?>">
|
|
<?php endif; ?>
|
|
<meta name="theme-color" content="#0f172a">
|
|
<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;800&display=swap" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
<link rel="stylesheet" href="<?= e(asset_url('assets/css/custom.css')) ?>">
|
|
<?php if (is_array($jsonLd) && $jsonLd !== []): ?>
|
|
<script type="application/ld+json"><?= json_encode($jsonLd, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) ?></script>
|
|
<?php endif; ?>
|
|
</head>
|
|
<body class="<?= e($bodyClass) ?>">
|
|
<a class="skip-link" href="#main-content">Lewati ke konten utama</a>
|
|
<header class="site-header sticky-top border-bottom">
|
|
<nav class="navbar navbar-expand-lg">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="index.php" aria-label="<?= e($brandName) ?>">
|
|
<span class="brand-mark" aria-hidden="true"></span>
|
|
<span class="brand-copy">
|
|
<span class="brand-title"><?= e($brandName) ?></span>
|
|
<span class="brand-subtitle">backlink microsite</span>
|
|
</span>
|
|
</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#siteNav" aria-controls="siteNav" aria-expanded="false" aria-label="Buka navigasi">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="siteNav">
|
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
|
<li class="nav-item"><a class="<?= e(nav_link_class('index.php')) ?>" href="index.php">Beranda</a></li>
|
|
<li class="nav-item"><a class="<?= e(nav_link_class('blog.php')) ?>" href="blog.php">Blog</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="index.php#strategi">Preview</a></li>
|
|
</ul>
|
|
<div class="nav-actions d-flex align-items-center gap-2">
|
|
<a class="btn btn-sm btn-outline-dark" href="sitemap.xml">Sitemap</a>
|
|
<a class="btn btn-sm btn-dark" href="<?= e(APKNUSA_URL) ?>" target="_blank" rel="noopener noreferrer">Kunjungi apknusa.com</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
<?php
|
|
}
|
|
|
|
function render_page_end(): void
|
|
{
|
|
$brandName = project_name();
|
|
?>
|
|
<footer class="site-footer border-top">
|
|
<div class="container py-4 d-flex flex-column flex-lg-row justify-content-between gap-3 align-items-start align-items-lg-center">
|
|
<div>
|
|
<div class="footer-title"><?= e($brandName) ?></div>
|
|
<p class="footer-copy mb-0">Artikel singkat, preview apknusa.com, dan CTA langsung ke website utama.</p>
|
|
</div>
|
|
<div class="footer-links d-flex flex-wrap gap-3">
|
|
<a href="index.php">Beranda</a>
|
|
<a href="blog.php">Blog</a>
|
|
<a href="index.php#strategi">Preview</a>
|
|
<a href="robots.txt">robots.txt</a>
|
|
<a href="sitemap.xml">sitemap.xml</a>
|
|
<a href="healthz.php">healthz</a>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
|
<script src="<?= e(asset_url('assets/js/main.js')) ?>" defer></script>
|
|
</body>
|
|
</html>
|
|
<?php
|
|
}
|