-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3a20e12
Showing
8 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# v1.0.0, 2018-03-26 | ||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 Flextype | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Sitemap Plugin for [Flextype](http://flextype.org/) | ||
 | ||
 | ||
[](https://github.com/flextype-plugins/tiny-url/blob/master/LICENSE.txt) | ||
|
||
Sitemap plugin provide automatically generated XML sitemap for Flextype. | ||
|
||
## Installation | ||
1. Unzip plugin to the folder `/site/plugins/` | ||
2. Go to `/site/config/site.yml` and add plugin name to plugins section. | ||
3. Save your changes. | ||
|
||
Example: | ||
``` | ||
... | ||
plugins: | ||
- sitemap | ||
``` | ||
|
||
## Settings | ||
|
||
```yaml | ||
enabled: true # or `false` to disable the plugin | ||
``` | ||
## License | ||
See [LICENSE](https://github.com/flextype-plugins/sitemap/blob/master/LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sitemap: "Sitemap" | ||
sitemap_description: "Sitemap plugin provide automatically generated XML sitemap for Flextype." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sitemap: "Sitemap" | ||
sitemap_description: "Sitemap plugin provide automatically generated XML sitemap for Flextype." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* Flextype Sitemap Plugin | ||
* | ||
* @author Romanenko Sergey / Awilum <[email protected]> | ||
* @link http://flextype.org | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Flextype; | ||
|
||
use Url; | ||
use Arr; | ||
use Response; | ||
use Request; | ||
|
||
if (Url::getUriSegment(0) == 'sitemap.xml') { | ||
Events::addListener('onPageBeforeRender', function () { | ||
Response::status(200); | ||
Request::setHeaders('Content-Type: text/xml; charset=utf-8'); | ||
|
||
$_pages = Pages::getPages('', false, 'date'); | ||
|
||
foreach ($_pages as $page) { | ||
if ($page['slug'] !== '404') { | ||
$pages[] = $page; | ||
} | ||
} | ||
|
||
include 'views/sitemap.php'; | ||
|
||
Request::shutdown(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Sitemap | ||
version: 1.0.0 | ||
description: "Provide automatically generated XML sitemap." | ||
author: | ||
name: Sergey Romanenko | ||
email: [email protected] | ||
url: http://flextype.org | ||
homepage: https://github.com/flextype-plugins/sitemap | ||
bugs: https://github.com/flextype-plugins/sitemap/issues | ||
license: MIT | ||
|
||
# Plugin settings | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'."\n"; ?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
<?php foreach ($pages as $page) { ?> | ||
<url> | ||
<loc><?php echo $page['url']; ?></loc> | ||
<lastmod><?php echo $page['date']; ?></lastmod> | ||
<changefreq><?php echo $page['changefreq'] ?? '1.0'; ?></changefreq> | ||
<priority>1.0</priority> | ||
</url> | ||
<?php } ?> | ||
</urlset> |