Set Content-Type for stylesheets

This commit is contained in:
Will Rossiter 2018-03-22 07:52:04 +13:00
parent 572da5fa8a
commit 64ead69f4e
3 changed files with 20 additions and 4 deletions

View File

@ -98,13 +98,29 @@ class GoogleSitemapController extends Controller
return str_replace('-', '\\', $class); return str_replace('-', '\\', $class);
} }
/**
* Render the stylesheet for the sitemap index
*
* @return DBHTMLText
*/
public function styleSheetIndex() 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() 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;
} }
} }

View File

@ -6,7 +6,7 @@
<head> <head>
<title>XML Sitemap</title> <title>XML Sitemap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{$BaseHref}resources/wilr/silverstripe-googlesitemaps/css/style.css" /> <link rel="stylesheet" href="$resourceURL(wilr/silverstripe-googlesitemaps:css/style.css)" />
</head> </head>
<body> <body>
<div id="content"> <div id="content">

View File

@ -6,7 +6,7 @@
<head> <head>
<title>XML Sitemap</title> <title>XML Sitemap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{$BaseHref}resources/wilr/silverstripe-googlesitemaps/css/style.css" /> <link rel="stylesheet" href="$resourceURL(wilr/silverstripe-googlesitemaps:css/style.css)" />
</head> </head>
<body> <body>
<div id="content"> <div id="content">