Update OpenSearch features to current standards

This commit is contained in:
Alex Cabal 2025-03-31 12:38:20 -05:00
parent 7da87bf9e2
commit 810087ccf9
14 changed files with 23 additions and 17 deletions

View file

@ -26,7 +26,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<name>Standard Ebooks</name> <name>Standard Ebooks</name>
<uri><?= SITE_URL ?></uri> <uri><?= SITE_URL ?></uri>
</author> </author>
<link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" /> <link href="<?= SITE_URL ?>/opensearch" rel="search" type="application/opensearchdescription+xml" title="Standard Ebooks"/>
<? foreach($entries as $entry){ ?> <? foreach($entries as $entry){ ?>
<?= Template::AtomFeedEntry(entry: $entry) ?> <?= Template::AtomFeedEntry(entry: $entry) ?>
<? } ?> <? } ?>

View file

@ -46,8 +46,7 @@ if(!$isErrorPage){
if(!$isXslt){ if(!$isXslt){
if(!$isSafari){ if(!$isSafari){
header('content-type: application/xhtml+xml; charset=utf-8'); header('content-type: application/xhtml+xml; charset=utf-8');
print('<?xml version="1.0" encoding="utf-8"?>'); print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
print("\n");
} }
print("<!DOCTYPE html>\n"); print("<!DOCTYPE html>\n");
} }
@ -100,8 +99,7 @@ if(!$isXslt){
<link rel="alternate" type="application/atom+xml;profile=opds-catalog;kind=acquisition" title="<?= Formatter::EscapeHtml($feedTitle) ?>" href="/feeds/opds<?= Formatter::EscapeHtml($feedUrl) ?>"/> <link rel="alternate" type="application/atom+xml;profile=opds-catalog;kind=acquisition" title="<?= Formatter::EscapeHtml($feedTitle) ?>" href="/feeds/opds<?= Formatter::EscapeHtml($feedUrl) ?>"/>
<link rel="alternate" type="application/rss+xml" title="<?= Formatter::EscapeHtml($feedTitle) ?>" href="/feeds/rss<?= Formatter::EscapeHtml($feedUrl) ?>"/> <link rel="alternate" type="application/rss+xml" title="<?= Formatter::EscapeHtml($feedTitle) ?>" href="/feeds/rss<?= Formatter::EscapeHtml($feedUrl) ?>"/>
<? } ?> <? } ?>
<link rel="search" href="/ebooks" type="application/xhtml+xml; charset=utf-8"/> <link rel="search" href="<?= SITE_URL ?>/opensearch" type="application/opensearchdescription+xml" title="Standard Ebooks"/><? // Firefox will show this as `Search with Standard Ebooks`. Can't include `charset` in the MIME type because Chrome will refuse it. ?>
<link rel="search" href="/ebooks/opensearch" type="application/opensearchdescription+xml; charset=utf-8"/>
<? if(!$isErrorPage){ ?> <? if(!$isErrorPage){ ?>
<meta content="#394451" name="theme-color"/> <meta content="#394451" name="theme-color"/>
<meta content="<? if($title !== null){ ?><?= Formatter::EscapeHtml($title) ?><? }else{ ?>Standard Ebooks<? } ?>" property="og:title"/> <meta content="<? if($title !== null){ ?><?= Formatter::EscapeHtml($title) ?><? }else{ ?>Standard Ebooks<? } ?>" property="og:title"/>

View file

@ -30,7 +30,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<link href="<?= SITE_URL ?>/feeds/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/> <link href="<?= SITE_URL ?>/feeds/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/>
<link href="<?= SITE_URL ?><?= Formatter::EscapeXml($parentUrl) ?>" rel="up" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/> <link href="<?= SITE_URL ?><?= Formatter::EscapeXml($parentUrl) ?>" rel="up" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/>
<link href="<?= SITE_URL ?>/feeds/opds/all" rel="http://opds-spec.org/crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8"/> <link href="<?= SITE_URL ?>/feeds/opds/all" rel="http://opds-spec.org/crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8"/>
<link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml; charset=utf-8"/> <link href="<?= SITE_URL ?>/opensearch" rel="search" type="application/opensearchdescription+xml" title="Standard Ebooks"/>
<title><?= Formatter::EscapeXml($title) ?></title> <title><?= Formatter::EscapeXml($title) ?></title>
<? if($subtitle !== null){ ?> <? if($subtitle !== null){ ?>
<subtitle><?= Formatter::EscapeXml($subtitle) ?></subtitle> <subtitle><?= Formatter::EscapeXml($subtitle) ?></subtitle>

View file

@ -21,7 +21,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<link href="<?= SITE_URL . Formatter::EscapeXml($url) ?>" rel="self" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/> <link href="<?= SITE_URL . Formatter::EscapeXml($url) ?>" rel="self" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/>
<link href="<?= SITE_URL ?>/feeds/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/> <link href="<?= SITE_URL ?>/feeds/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/>
<link href="<?= SITE_URL ?>/feeds/opds/all" rel="http://opds-spec.org/crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8"/> <link href="<?= SITE_URL ?>/feeds/opds/all" rel="http://opds-spec.org/crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8"/>
<link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml; charset=utf-8"/> <link href="<?= SITE_URL ?>/opensearch" rel="search" type="application/opensearchdescription+xml" title="Standard Ebooks"/>
<? if($parentUrl !== null){ ?> <? if($parentUrl !== null){ ?>
<link href="<?= SITE_URL ?><?= Formatter::EscapeXml($parentUrl) ?>" rel="up" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/> <link href="<?= SITE_URL ?><?= Formatter::EscapeXml($parentUrl) ?>" rel="up" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/>
<? } ?> <? } ?>

View file

@ -21,7 +21,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
<lastBuildDate><?= $updated->format(Enums\DateTimeFormat::Rss->value); ?></lastBuildDate> <lastBuildDate><?= $updated->format(Enums\DateTimeFormat::Rss->value); ?></lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs> <docs>http://blogs.law.harvard.edu/tech/rss</docs>
<atom:link href="<?= SITE_URL . Formatter::EscapeXml($url) ?>" rel="self" type="application/rss+xml"/> <atom:link href="<?= SITE_URL . Formatter::EscapeXml($url) ?>" rel="self" type="application/rss+xml"/>
<atom:link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" /> <atom:link href="<?= SITE_URL ?>/opensearch" rel="search" type="application/opensearchdescription+xml" title="Standard Ebooks"/>
<image> <image>
<url><?= SITE_URL ?>/images/logo-rss.png</url> <url><?= SITE_URL ?>/images/logo-rss.png</url>
<title><?= Formatter::EscapeXml($title) ?></title> <? /* must be identical to channel title */ ?> <title><?= Formatter::EscapeXml($title) ?></title> <? /* must be identical to channel title */ ?>

View file

@ -161,6 +161,10 @@ form[action^="/artworks/"]{
width: auto; width: auto;
} }
.artworks p.no-results{
margin-top: 4rem;
}
.artworks form.browse-artwork button{ .artworks form.browse-artwork button{
justify-self: end; justify-self: end;
grid-column: 1 / span 4; grid-column: 1 / span 4;

View file

@ -1793,7 +1793,7 @@ main nav.pagination ol li a:hover{
} }
p.no-results{ p.no-results{
margin-top: 4rem; margin-top: 2rem;
margin-bottom: 2rem; margin-bottom: 2rem;
font-style: italic; font-style: italic;
text-align: center; text-align: center;

View file

@ -11,8 +11,7 @@ catch(Exceptions\EbookNotFoundException){
} }
header('content-type: application/xml; charset=utf-8'); header('content-type: application/xml; charset=utf-8');
print('<?xml version="1.0" encoding="utf-8"?>'); print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
print("\n");
?> ?>
<collections> <collections>
<? foreach($ebook->CollectionMemberships as $collectionMembership){ ?> <? foreach($ebook->CollectionMemberships as $collectionMembership){ ?>

View file

@ -13,8 +13,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet href=\"" . S
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<id><?= SITE_URL ?>/feeds/atom/all?query=<?= urlencode($query) ?></id> <id><?= SITE_URL ?>/feeds/atom/all?query=<?= urlencode($query) ?></id>
<link href="<?= SITE_URL ?>/feeds/atom/all?query=<?= urlencode($query) ?>" rel="self" type="application/atom+xml"/> <link href="<?= SITE_URL ?>/feeds/atom/all?query=<?= urlencode($query) ?>" rel="self" type="application/atom+xml"/>
<link href="<?= SITE_URL ?>/ebooks/ebooks?query=<?= urlencode($query) ?>" rel="alternate" type="text/html"/> <link href="<?= SITE_URL ?>/opensearch" rel="search" type="application/opensearchdescription+xml" title="Standard Ebooks"/>
<link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml"/>
<title>Search Results</title> <title>Search Results</title>
<subtitle>Results for <?= Formatter::EscapeXml($query) ?>”.</subtitle> <subtitle>Results for <?= Formatter::EscapeXml($query) ?>”.</subtitle>
<icon><?= SITE_URL ?>/images/logo.png</icon> <icon><?= SITE_URL ?>/images/logo.png</icon>

View file

@ -16,7 +16,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet href=\"". SI
<link href="<?= SITE_URL ?>/ebooks/ebooks?query=<?= urlencode($query) ?>" rel="alternate" type="text/html"/> <link href="<?= SITE_URL ?>/ebooks/ebooks?query=<?= urlencode($query) ?>" rel="alternate" type="text/html"/>
<link href="<?= SITE_URL ?>/feeds/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/> <link href="<?= SITE_URL ?>/feeds/opds" rel="start" type="application/atom+xml;profile=opds-catalog;kind=navigation; charset=utf-8"/>
<link href="<?= SITE_URL ?>/feeds/opds/all" rel="http://opds-spec.org/crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8"/> <link href="<?= SITE_URL ?>/feeds/opds/all" rel="http://opds-spec.org/crawlable" type="application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8"/>
<link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml; charset=utf-8"/> <link href="<?= SITE_URL ?>/opensearch" rel="search" type="application/opensearchdescription+xml" title="Standard Ebooks"/>
<title>Search Results</title> <title>Search Results</title>
<subtitle>Results for <?= Formatter::EscapeXml($query) ?>”.</subtitle> <subtitle>Results for <?= Formatter::EscapeXml($query) ?>”.</subtitle>
<icon><?= SITE_URL ?>/images/logo.png</icon> <icon><?= SITE_URL ?>/images/logo.png</icon>

View file

@ -20,7 +20,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet href=\"" . S
<lastBuildDate><?= NOW->format(Enums\DateTimeFormat::Rss->value) ?></lastBuildDate> <lastBuildDate><?= NOW->format(Enums\DateTimeFormat::Rss->value) ?></lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs> <docs>http://blogs.law.harvard.edu/tech/rss</docs>
<atom:link href="<?= SITE_URL ?>/feeds/rss/all?query=<?= urlencode($query) ?>" rel="self" type="application/rss+xml"/> <atom:link href="<?= SITE_URL ?>/feeds/rss/all?query=<?= urlencode($query) ?>" rel="self" type="application/rss+xml"/>
<atom:link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" /> <atom:link href="<?= SITE_URL ?>/opensearch" rel="search" type="application/opensearchdescription+xml" title="Standard Ebooks" />
<image> <image>
<url><?= SITE_URL ?>/images/logo-rss.png</url> <url><?= SITE_URL ?>/images/logo-rss.png</url>
<title>Search Results</title> <? /* must be identical to channel title */ ?> <title>Search Results</title> <? /* must be identical to channel title */ ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

@ -1,6 +1,6 @@
<? <?
header('Content-Type: text/xml; charset=utf-8'); header('Content-Type: application/opensearchdescription+xml'); // Can't include `charset` because Chrome doesn't like it.
print('<?xml version="1.0" encoding="utf-8"?>'); print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
?> ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Standard Ebooks</ShortName> <ShortName>Standard Ebooks</ShortName>
@ -10,6 +10,12 @@ print('<?xml version="1.0" encoding="utf-8"?>');
<SyndicationRight>open</SyndicationRight> <SyndicationRight>open</SyndicationRight>
<OutputEncoding>UTF-8</OutputEncoding> <OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding> <InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon"><?= SITE_URL ?>/favicon-16x16.ico</Image>
<Image width="48" height="48" type="image/x-icon"><?= SITE_URL ?>/favicon.ico</Image>
<Image width="64" height="64" type="image/png"><?= SITE_URL ?>/favicon-64x64.png</Image>
<Url type="application/opensearchdescription+xml" rel="self" template="<?= SITE_URL ?>/opensearch" />
<Url type="text/html" template="<?= SITE_URL ?>/ebooks?query={searchTerms}&amp;per-page={count}&amp;page={startPage}"/><? // For compatibility; most OpenSearch parsers don't understand `application/xhtml+xml`. ?>
<Url type="application/xhtml+xml" template="<?= SITE_URL ?>/ebooks?query={searchTerms}&amp;per-page={count}&amp;page={startPage}"/> <Url type="application/xhtml+xml" template="<?= SITE_URL ?>/ebooks?query={searchTerms}&amp;per-page={count}&amp;page={startPage}"/>
<Url type="application/rss+xml" template="<?= SITE_URL ?>/feeds/rss/all?query={searchTerms}&amp;per-page={count}&amp;page={startPage}"/> <Url type="application/rss+xml" template="<?= SITE_URL ?>/feeds/rss/all?query={searchTerms}&amp;per-page={count}&amp;page={startPage}"/>
<Url type="application/atom+xml" template="<?= SITE_URL ?>/feeds/atom/all?query={searchTerms}&amp;per-page={count}&amp;page={startPage}"/> <Url type="application/atom+xml" template="<?= SITE_URL ?>/feeds/atom/all?query={searchTerms}&amp;per-page={count}&amp;page={startPage}"/>