From 64ead69f4ea814c27d53756cbf8785b0bace22b1 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 22 Mar 2018 07:52:04 +1300 Subject: [PATCH] Set Content-Type for stylesheets --- src/Control/GoogleSitemapController.php | 20 ++++++++++++++++++-- templates/xml-sitemap.ss | 2 +- templates/xml-sitemapindex.ss | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Control/GoogleSitemapController.php b/src/Control/GoogleSitemapController.php index 6c02e68..81b9f37 100644 --- a/src/Control/GoogleSitemapController.php +++ b/src/Control/GoogleSitemapController.php @@ -98,13 +98,29 @@ class GoogleSitemapController extends Controller return str_replace('-', '\\', $class); } + /** + * Render the stylesheet for the sitemap index + * + * @return DBHTMLText + */ public function styleSheetIndex() { - return $this->renderWith('xml-sitemapindex'); + $html = $this->renderWith('xml-sitemapindex'); + $this->getResponse()->addHeader('Content-Type', 'text/xsl; charset="utf-8"'); + + return $html; } + /** + * Render the stylesheet for the sitemap + * + * @return DBHTMLText + */ public function styleSheet() { - return $this->renderWith('xml-sitemap'); + $html = $this->renderWith('xml-sitemap'); + $this->getResponse()->addHeader('Content-Type', 'text/xsl; charset="utf-8"'); + + return $html; } } diff --git a/templates/xml-sitemap.ss b/templates/xml-sitemap.ss index 9c60b41..33b4ca6 100644 --- a/templates/xml-sitemap.ss +++ b/templates/xml-sitemap.ss @@ -6,7 +6,7 @@ XML Sitemap - +
diff --git a/templates/xml-sitemapindex.ss b/templates/xml-sitemapindex.ss index f8d8c04..01acf07 100644 --- a/templates/xml-sitemapindex.ss +++ b/templates/xml-sitemapindex.ss @@ -6,7 +6,7 @@ XML Sitemap - +