Well I sure botched the feeds.

This commit is contained in:
Greg Sarjeant 2025-06-13 17:42:02 -04:00
parent 52a77a3dc2
commit 4e711265ff
3 changed files with 28 additions and 9 deletions

View File

@ -3,16 +3,19 @@
<?php
$siteTitle = htmlspecialchars($config->siteTitle);
$siteUrl = htmlspecialchars($config->baseUrl);
$basePath = $siteUrl . htmlspecialchars($config->basePath);
$basePath = htmlspecialchars($config->basePath);
$updated = date(DATE_ATOM, strtotime($ticks[0]['timestamp'] ?? 'now'));
header('Content-Type: application/atom+xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><?= $siteTitle ?></title>
<link ref="<?= $siteUrl ?>feed/atom" rel="self"/>
<link href="<?= $siteUrl ?>"/>
<title><?= "$siteTitle Atom Feed" ?></title>
<link rel="self"
type="application/atom+xml"
title="<?php echo htmlspecialchars($config->siteTitle) ?> Atom Feed"
href="<?php echo htmlspecialchars($siteUrl . $basePath) ?>feed/atom" />
<link rel="alternate" href="<?= $siteUrl ?>"/>
<updated><?= $updated ?></updated>
<id><?= $siteUrl ?></id>
<author>
@ -27,7 +30,7 @@ echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
[$hour, $minute, $second] = $timeParts;
$tickPath = "$year/$month/$day/$hour/$minute/$second";
$tickUrl = htmlspecialchars($basePath . "tick/$tickPath");
$tickUrl = htmlspecialchars($siteUrl . $basePath . "tick/$tickPath");
$tickTime = date(DATE_ATOM, strtotime($tick['timestamp']));
$tickText = htmlspecialchars($tick['tick']);
?>

View File

@ -10,7 +10,13 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
<rss version="2.0">
<channel>
<title>My tkr</title>
<link rel="alternate" type="application/rss+xml" title="Tick RSS" href="/tkr/rss/">
<link rel="self"
type="application/rss+xml"
title="<?php echo htmlspecialchars($config->siteTitle) ?> RSS Feed"
href="<?php echo htmlspecialchars($config->baseUrl . $config->basePath)?>feed/rss/" />
<link rel="alternate"
type="text/html"
href=<?php echo htmlspecialchars($config->baseUrl . $config->basePath) ?> />
<description>My tkr</description>
<language>en-us</language>
<lastBuildDate><?php echo date(DATE_RSS); ?></lastBuildDate>

View File

@ -8,10 +8,20 @@
<title><?= $config->siteTitle ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?= htmlspecialchars($config->basePath) ?>css/tkr.css?v=<?= time() ?>">
<link rel="stylesheet"
href="<?= htmlspecialchars($config->basePath) ?>css/tkr.css?v=<?= time() ?>">
<?php if (!empty($config->cssId)): ?>
<link rel="stylesheet" href="<?= htmlspecialchars($config->basePath) ?>css/custom/<?= htmlspecialchars($config->customCssFilename()) ?>">
<?php endif; ?>
<link rel="stylesheet"
href="<?= htmlspecialchars($config->basePath) ?>css/custom/<?= htmlspecialchars($config->customCssFilename()) ?>">
<?php endif; ?>
<link rel="alternate"
type="application/rss+xml"
title="<?php echo htmlspecialchars($config->siteTitle) ?> RSS Feed"
href="<?php echo htmlspecialchars($config->baseUrl . $config->basePath)?>feed/rss/" />
<link rel="alternate"
type="application/atom+xml"
title="<?php echo htmlspecialchars($config->siteTitle) ?> Atom Feed"
href="<?php echo htmlspecialchars($config->baseUrl . $config->basePath)?>feed/atom/" />
</head>
<body>
<?php include TEMPLATES_DIR . '/partials/navbar.php'?>