Skip to content

Commit

Permalink
Add index pages for RSS/Atom roots
Browse files Browse the repository at this point in the history
  • Loading branch information
acabal committed Jun 24, 2022
1 parent 1266c58 commit ee54550
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@

const FA_FEE_PERCENT = 0.87;

const SE_SUBJECTS = ['Adventure', 'Autobiography', 'Biography', 'Children’s', '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_STRING', 'January 1, ' . (PD_YEAR + 1));

Expand Down
36 changes: 36 additions & 0 deletions www/atom/index.php
Original file line number Diff line number Diff line change
@@ -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() ?>
8 changes: 3 additions & 5 deletions www/feeds/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
// 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`).

$subjects = ["Adventure", "Autobiography", "Biography", "Children’s", "Comedy", "Drama", "Fantasy", "Fiction", "Horror", "Memoir", "Mystery", "Nonfiction", "Philosophy", "Poetry", "Satire", "Science Fiction", "Shorts", "Spirituality", "Tragedy", "Travel"];

?><?= Template::Header(['description' => 'A list of available feeds of Standard Ebooks ebooks.']) ?>
?><?= Template::Header(['title' => 'Ebook Feeds', 'description' => 'A list of available feeds of Standard Ebooks ebooks.']) ?>
<main>
<article>
<h1>Ebook Feeds</h1>
Expand Down Expand Up @@ -55,7 +53,7 @@
<section id="atom-ebooks-by-subject">
<h3>Ebooks by subject</h3>
<ul class="feed">
<? foreach($subjects as $subject){ ?>
<? 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>
Expand Down Expand Up @@ -83,7 +81,7 @@
<section id="rss-ebooks-by-subject">
<h3>Ebooks by subject</h3>
<ul class="feed">
<? foreach($subjects as $subject){ ?>
<? 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>
Expand Down
35 changes: 35 additions & 0 deletions www/rss/index.php
Original file line number Diff line number Diff line change
@@ -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() ?>

0 comments on commit ee54550

Please sign in to comment.