Permalink
Browse files

Added ability to access sitemap URL without the `.xml` extension. (ne…

…eds Grav 1.1.6+)
  • Loading branch information...
rhukster committed Sep 30, 2016
1 parent fb035dd commit 00c23738bdbfe9683627bf0f99bda12eab9505d5
Showing with 17 additions and 2 deletions.
  1. +6 −0 CHANGELOG.md
  2. +3 −0 blueprints.yaml
  3. +3 −0 pages/sitemap.md
  4. +5 −2 sitemap.php
View
@@ -1,3 +1,9 @@
# v1.7.0
## xx/xx/2016
1. [](#new)
* Use new Grav feature to force output to be XML even when not passed `.xml` in URL
# v1.6.2
## 07/14/2016
View
@@ -11,6 +11,9 @@ keywords: sitemap, plugin, xml, map, index
bugs: https://github.com/getgrav/grav-plugin-sitemap/issues
license: MIT
dependencies:
- { name: grav, version: '>=1.1.6' }
form:
validation: strict
fields:
View
@@ -0,0 +1,3 @@
---
template_format: xml
---
View
@@ -2,6 +2,7 @@
namespace Grav\Plugin;
use Grav\Common\Data;
use Grav\Common\Page\Page;
use Grav\Common\Plugin;
use Grav\Common\Uri;
use Grav\Common\Page\Pages;
@@ -89,9 +90,11 @@ public function onPagesInitialized()
public function onPageInitialized()
{
// set a dummy page
$home = $this->grav['page']->find('/');
$page = new Page;
$page->init(new \SplFileInfo(__DIR__ . '/pages/sitemap.md'));
unset($this->grav['page']);
$this->grav['page'] = $home;
$this->grav['page'] = $page;
}
/**

0 comments on commit 00c2373

Please sign in to comment.