Change OPDS feed to show number of ebooks in each subject category, and a 'related' link back to the ebook's SE homepage

This commit is contained in:
Alex Cabal 2020-07-09 13:03:20 -05:00
parent 53f1e7ab29
commit 75e7cce726
2 changed files with 9 additions and 2 deletions

View file

@ -43,8 +43,14 @@ foreach($contentFiles as $path){
sort($subjects);
$subjectNavigationEntries = [];
foreach($subjects as $subject){
// We leave the updated timestamp blank, as it will be filled in when we generate the individaul feeds
$subjectNavigationEntries[] = new OpdsNavigationEntry('/opds/subjects/' . Formatter::MakeUrlSafe($subject), 'subsection', 'navigation', null, $subject, 'Browse Standard Ebooks tagged with “' . strtolower($subject) . ',” most-recently-released first.');
$summary = number_format(sizeof($ebooksBySubject[$subject])) . ' Standard Ebook';
if(sizeof($ebooksBySubject[$subject]) != 1){
$summary .= 's';
}
$summary .= ' tagged with “' . strtolower($subject) . ',” most-recently-released first.';
// We leave the updated timestamp blank, as it will be filled in when we generate the individual feeds
$subjectNavigationEntries[] = new OpdsNavigationEntry('/opds/subjects/' . Formatter::MakeUrlSafe($subject), 'subsection', 'navigation', null, $subject, $summary);
}
$subjectsFeed = new OpdsNavigationFeed('/opds/subjects', 'Standard Ebooks by Subject', '/opds', $subjectNavigationEntries);
$subjectsFeed->Save(WEB_ROOT . '/opds/subjects/index.xml');

View file

@ -24,6 +24,7 @@
<? } ?>
<link href="<?= $ebook->Url ?>/dist/cover.jpg" rel="http://opds-spec.org/image" type="image/jpeg"/>
<link href="<?= $ebook->Url ?>/dist/cover-thumbnail.jpg" rel="http://opds-spec.org/image/thumbnail" type="image/jpeg"/>
<link href="<?= $ebook->Url ?>" rel="related" type="text/html" title="This ebooks page at Standard Ebooks"/>
<link href="<?= $ebook->EpubUrl ?>" rel="http://opds-spec.org/acquisition/open-access" type="application/epub+zip" title="Recommended compatible epub"/>
<link href="<?= $ebook->Epub3Url ?>" rel="http://opds-spec.org/acquisition/open-access" type="application/epub+zip" title="epub"/>
<link href="<?= $ebook->KepubUrl ?>" rel="http://opds-spec.org/acquisition/open-access" type="application/kepub+zip" title="Kobo Kepub epub"/>