Add index pages for RSS/Atom roots

This commit is contained in:
Alex Cabal 2022-06-24 11:00:42 -05:00
parent 1266c5859b
commit ee545502af
4 changed files with 76 additions and 5 deletions

View file

@ -78,6 +78,8 @@ const PAYMENT_CHANNEL_FA = 0;
const FA_FEE_PERCENT = 0.87; const FA_FEE_PERCENT = 0.87;
const SE_SUBJECTS = ['Adventure', 'Autobiography', 'Biography', 'Childrens', 'Comedy', 'Drama', 'Fantasy', 'Fiction', 'Horror', 'Memoir', 'Mystery', 'Nonfiction', 'Philosophy', 'Poetry', 'Satire', 'Science Fiction', 'Shorts', 'Spirituality', 'Tragedy', 'Travel'];
define('PD_YEAR', intval(gmdate('Y')) - 96); define('PD_YEAR', intval(gmdate('Y')) - 96);
define('PD_STRING', 'January 1, ' . (PD_YEAR + 1)); define('PD_STRING', 'January 1, ' . (PD_YEAR + 1));

36
www/atom/index.php Normal file
View file

@ -0,0 +1,36 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'Atom Ebook Feeds', 'description' => 'A list of available Atom 1.0 feeds of Standard Ebooks ebooks.']) ?>
<main>
<article>
<h1>Atom 1.0 Feeds</h1>
<p>Atom feeds can be read by one of the many <a href="https://en.wikipedia.org/wiki/Comparison_of_feed_aggregators">RSS clients</a> available for download, like <a href="https://www.thunderbird.net/en-US/">Thunderbird</a>. They contain more information than regular RSS feeds. Most RSS clients can read both Atom and RSS feeds.</p>
<p>Note that some RSS readers may show these feeds ordered by when an ebook was last updated, even though the feeds are ordered by when an ebook was first released. You should be able to change the sort order in your RSS reader.</p>
<ul class="feed">
<li>
<p><a href="/atom/new-releases">New releases</a></p>
<p class="url"><?= SITE_URL ?>/atom/new-releases</p>
<p>The thirty latest Standard Ebooks, most-recently-released first.</p>
</li>
<li>
<p><a href="/atom/all">All ebooks</a></p>
<p class="url"><?= SITE_URL ?>/atom/all</p>
<p>All Standard Ebooks, most-recently-released first.</p>
</li>
</ul>
<section id="atom-ebooks-by-subject">
<h2>Ebooks by subject</h2>
<ul class="feed">
<? foreach(SE_SUBJECTS as $subject){ ?>
<li>
<p><a href="/atom/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"><?= Formatter::ToPlainText($subject) ?></a></p>
<p><a href="/atom/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"></a></p>
<p class="url"><?= SITE_URL ?>/atom/subjects/<?= Formatter::MakeUrlSafe($subject) ?></p>
</li>
<? } ?>
</ul>
</section>
</article>
</main>
<?= Template::Footer() ?>

View file

@ -8,9 +8,7 @@ require_once('Core.php');
// It also displays the feed in a browser so we can style it with XSLT. // It also displays the feed in a browser so we can style it with XSLT.
// This is the same for Atom/OPDS (whose de jure mime type is `application/atom+xml`). // This is the same for Atom/OPDS (whose de jure mime type is `application/atom+xml`).
$subjects = ["Adventure", "Autobiography", "Biography", "Childrens", "Comedy", "Drama", "Fantasy", "Fiction", "Horror", "Memoir", "Mystery", "Nonfiction", "Philosophy", "Poetry", "Satire", "Science Fiction", "Shorts", "Spirituality", "Tragedy", "Travel"]; ?><?= Template::Header(['title' => 'Ebook Feeds', 'description' => 'A list of available feeds of Standard Ebooks ebooks.']) ?>
?><?= Template::Header(['description' => 'A list of available feeds of Standard Ebooks ebooks.']) ?>
<main> <main>
<article> <article>
<h1>Ebook Feeds</h1> <h1>Ebook Feeds</h1>
@ -55,7 +53,7 @@ $subjects = ["Adventure", "Autobiography", "Biography", "Childrens", "Comedy"
<section id="atom-ebooks-by-subject"> <section id="atom-ebooks-by-subject">
<h3>Ebooks by subject</h3> <h3>Ebooks by subject</h3>
<ul class="feed"> <ul class="feed">
<? foreach($subjects as $subject){ ?> <? foreach(SE_SUBJECTS as $subject){ ?>
<li> <li>
<p><a href="/atom/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"><?= Formatter::ToPlainText($subject) ?></a></p> <p><a href="/atom/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"><?= Formatter::ToPlainText($subject) ?></a></p>
<p><a href="/atom/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"></a></p> <p><a href="/atom/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"></a></p>
@ -83,7 +81,7 @@ $subjects = ["Adventure", "Autobiography", "Biography", "Childrens", "Comedy"
<section id="rss-ebooks-by-subject"> <section id="rss-ebooks-by-subject">
<h3>Ebooks by subject</h3> <h3>Ebooks by subject</h3>
<ul class="feed"> <ul class="feed">
<? foreach($subjects as $subject){ ?> <? foreach(SE_SUBJECTS as $subject){ ?>
<li> <li>
<p><a href="/rss/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"><?= Formatter::ToPlainText($subject) ?></a></p> <p><a href="/rss/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"><?= Formatter::ToPlainText($subject) ?></a></p>
<p><a href="/rss/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"></a></p> <p><a href="/rss/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"></a></p>

35
www/rss/index.php Normal file
View file

@ -0,0 +1,35 @@
<?
require_once('Core.php');
?><?= Template::Header(['title' => 'RSS Ebook Feeds', 'description' => 'A list of available RSS 2.0 feeds of Standard Ebooks ebooks.']) ?>
<main>
<article>
<h1>RSS 2.0 feeds</h1>
<p>RSS feeds are an alternative to Atom feeds. They contain less information than Atom feeds, but might be better supported by some RSS readers.</p>
<ul class="feed">
<li>
<p><a href="/rss/new-releases">New releases</a></p>
<p class="url"><?= SITE_URL ?>/rss/new-releases</p>
<p>The thirty latest Standard Ebooks, most-recently-released first.</p>
</li>
<li>
<p><a href="/rss/all">All ebooks</a></p>
<p class="url"><?= SITE_URL ?>/rss/all</p>
<p>All Standard Ebooks, most-recently-released first.</p>
</li>
</ul>
<section id="rss-ebooks-by-subject">
<h3>Ebooks by subject</h3>
<ul class="feed">
<? foreach(SE_SUBJECTS as $subject){ ?>
<li>
<p><a href="/rss/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"><?= Formatter::ToPlainText($subject) ?></a></p>
<p><a href="/rss/subjects/<?= Formatter::MakeUrlSafe($subject) ?>"></a></p>
<p class="url"><?= SITE_URL ?>/rss/subjects/<?= Formatter::MakeUrlSafe($subject) ?></p>
</li>
<? } ?>
</ul>
</section>
</article>
</main>
<?= Template::Footer() ?>