mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
Continue improving serving and display of RSS/OPDS
This commit is contained in:
parent
06787c5f57
commit
37830e173f
5 changed files with 29 additions and 13 deletions
|
@ -96,16 +96,23 @@ Define webroot /standardebooks.org/web
|
|||
Header set Content-Disposition "attachment; filename=%{FILENAME}e"
|
||||
</Location>
|
||||
|
||||
<Location ~ ^/opds.+?$>
|
||||
DirectoryIndex index.xml
|
||||
</location>
|
||||
|
||||
# We explicitly set the content-type for items in the /vocab/ directory, because Apache doesn't set it for us,
|
||||
# and we need a content-type header when using the "nosniff" header. See https://bugzilla.mozilla.org/show_bug.cgi?id=1547076
|
||||
<Location ~ ^/vocab/.+$>
|
||||
Header set Content-Type "text/plain"
|
||||
</location>
|
||||
|
||||
# text/xml allows the page to be displayed in a browser. application/atom+xml will cause it to be downloaded.
|
||||
<Location ~ ^/opds.+?$>
|
||||
DirectoryIndex index.xml
|
||||
Header set Content-Type "text/xml"
|
||||
</location>
|
||||
|
||||
# text/xml allows the page to be displayed in a browser. application/rss+xml will cause it to be downloaded.
|
||||
<Location ~ ^/rss/.*$>
|
||||
Header set Content-Type "text/xml"
|
||||
</Location>
|
||||
|
||||
# Enable HTTP CORS so that browser-based readers like Readium can access opds and ebooks
|
||||
# Allow fonts for newsletter emails
|
||||
# See https://github.com/standardebooks/tools/issues/2
|
||||
|
|
|
@ -95,16 +95,23 @@ Define webroot /standardebooks.org/web
|
|||
Header set Content-Disposition "attachment; filename=%{FILENAME}e"
|
||||
</Location>
|
||||
|
||||
<Location ~ ^/opds.+?$>
|
||||
DirectoryIndex index.xml
|
||||
</location>
|
||||
|
||||
# We explicitly set the content-type for items in the /vocab/ directory, because Apache doesn't set it for us,
|
||||
# and we need a content-type header when using the "nosniff" header. See https://bugzilla.mozilla.org/show_bug.cgi?id=1547076
|
||||
<Location ~ ^/vocab/.+$>
|
||||
Header set Content-Type "text/plain"
|
||||
</location>
|
||||
|
||||
# text/xml allows the page to be displayed in a browser. application/atom+xml will cause it to be downloaded.
|
||||
<Location ~ ^/opds.+?$>
|
||||
DirectoryIndex index.xml
|
||||
Header set Content-Type "text/xml"
|
||||
</location>
|
||||
|
||||
# text/xml allows the page to be displayed in a browser. application/rss+xml will cause it to be downloaded.
|
||||
<Location ~ ^/rss/.*$>
|
||||
Header set Content-Type "text/xml"
|
||||
</Location>
|
||||
|
||||
# Enable HTTP CORS so that browser-based readers like Readium can access opds and ebooks
|
||||
# Allow fonts for newsletter emails
|
||||
# See https://github.com/standardebooks/tools/issues/2
|
||||
|
|
|
@ -35,7 +35,8 @@ krsort($sortedContentFiles);
|
|||
|
||||
$sortedContentFiles = array_slice($sortedContentFiles, 0, $rssLength);
|
||||
|
||||
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet href=\"/rss/style\" type=\"application/xslt+xml\"?>\n");
|
||||
// XSL stylesheet mime type must be `text/xsl` otherwise Chrome doesn't read it
|
||||
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet href=\"/rss/style\" type=\"text/xsl\"?>\n");
|
||||
?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
|
|
|
@ -17,7 +17,6 @@ catch(\Exception $ex){
|
|||
include(WEB_ROOT . '/404.php');
|
||||
exit();
|
||||
}
|
||||
header('Content-type: text/xml');
|
||||
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:schema="http://schema.org/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<?
|
||||
require_once('Core.php');
|
||||
header('content-type: application/xslt+xml');
|
||||
|
||||
// `text/xsl` is the only mime type recognized by Chrome for XSL stylesheets
|
||||
header('Content-Type: text/xsl');
|
||||
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
?>
|
||||
<xsl:stylesheet version="3.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<xsl:output method="html" html-version="5.0" encoding="utf-8" indent="true"/>
|
||||
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<xsl:output method="html" html-version="5.0" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat"/> <? /* doctype-system outputs the HTML5 doctype */ ?>
|
||||
<xsl:template match="/">
|
||||
<?= Template::Header(['xmlDeclaration' => false]) ?>
|
||||
<main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue