Files
2026-07-07 15:43:59 -04:00

46 lines
1.7 KiB
PHP

<?php
$title = 'Links';
$description = 'A collection of interesting and useful websites.';
include $_SERVER['DOCUMENT_ROOT'] . '/includes/head.php';
$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/assets/data/links.json'), true);
$categories = $data['categories'] ?? [];
?>
<body>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/includes/nav.php'; ?>
<main class="page">
<div class="wrap">
<h1>Links</h1>
<p class="incantation">A collection of interesting and useful websites.</p>
<div class="entry-list">
<?php foreach ($categories as $cat): ?>
<section class="cat-box">
<h2><?= htmlspecialchars($cat['name']) ?></h2>
<ul class="link-list">
<?php foreach ($cat['links'] as $link):
$domain = preg_replace('/^www\./', '', parse_url($link['url'], PHP_URL_HOST));
?>
<li>
<a href="<?= htmlspecialchars($link['url']) ?>" target="_blank" rel="noopener" class="link-entry">
<span class="lk-row">
<span class="lk-title"><?= htmlspecialchars($link['title']) ?></span>
<span class="lk-domain"><?= $domain ?></span>
</span>
<?php if (!empty($link['note'])): ?>
<span class="lk-note"><?= htmlspecialchars($link['note']) ?></span>
<?php endif; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endforeach; ?>
</div>
</div>
</main>
</body>
</html>