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

View File

@ -10,7 +10,13 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
<rss version="2.0"> <rss version="2.0">
<channel> <channel>
<title>My tkr</title> <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> <description>My tkr</description>
<language>en-us</language> <language>en-us</language>
<lastBuildDate><?php echo date(DATE_RSS); ?></lastBuildDate> <lastBuildDate><?php echo date(DATE_RSS); ?></lastBuildDate>

View File

@ -8,10 +8,20 @@
<title><?= $config->siteTitle ?></title> <title><?= $config->siteTitle ?></title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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)): ?> <?php if (!empty($config->cssId)): ?>
<link rel="stylesheet" href="<?= htmlspecialchars($config->basePath) ?>css/custom/<?= htmlspecialchars($config->customCssFilename()) ?>"> <link rel="stylesheet"
href="<?= htmlspecialchars($config->basePath) ?>css/custom/<?= htmlspecialchars($config->customCssFilename()) ?>">
<?php endif; ?> <?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> </head>
<body> <body>
<?php include TEMPLATES_DIR . '/partials/navbar.php'?> <?php include TEMPLATES_DIR . '/partials/navbar.php'?>