Skip to content

Commit

Permalink
Sitemap 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Dec 5, 2019
1 parent 4b5c1af commit c0152ba
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v1.7.0, 2019-12-05
* Updates for Flextype 0.9.6

# v1.6.0, 2019-09-15
* Updates for Flextype 0.9.4

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sitemap Plugin for [Flextype](http://flextype.org/)
![version](https://img.shields.io/badge/version-1.6.0-brightgreen.svg?style=flat-square "Version")
![Flextype](https://img.shields.io/badge/Flextype-0.9.4-green.svg?style=flat-square "Flextype Version")
![version](https://img.shields.io/badge/version-1.7.0-brightgreen.svg?style=flat-square "Version")
![Flextype](https://img.shields.io/badge/Flextype-0.9.6-green.svg?style=flat-square "Flextype Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/flextype-plugins/tiny-url/blob/master/LICENSE.txt)

Sitemap plugin provide automatically generated XML sitemap for Flextype.
Expand Down
14 changes: 8 additions & 6 deletions app/Controllers/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ class SitemapController extends Controller {
*/
public function index(Request $request, Response $response) : Response
{
$_entries = $this->entries->fetchAll('', ['recursive' => true, 'order_by' => ['field' => 'published_at', 'direction' => 'desc']]);
$entries = [];
$sitemap = [];
$entries = $this->entries->fetch('', ['recursive' => true, 'order_by' => ['field' => 'published_at', 'direction' => 'desc']]);

foreach ($_entries as $entry) {
if (!(isset($entry['visibility']) && ($entry['visibility'] === 'draft' || $entry['visibility'] === 'hidden'))) {
$entries[] = $entry;
foreach ($entries as $entry) {

if (!((isset($entry['visibility']) && ($entry['visibility'] === 'draft' || $entry['visibility'] === 'hidden')) ||
(isset($entry['routable']) && ($entry['routable'] === false)))) {
$sitemap[] = $entry;
}
}

Expand All @@ -35,7 +37,7 @@ public function index(Request $request, Response $response) : Response
$response,
'plugins/sitemap/views/templates/index.html',
[
'entries' => $entries
'sitemap' => $sitemap
]);
}
}
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Sitemap
version: 1.6.0
version: 1.7.0
description: Provide automatically generated XML sitemap.
author:
name: Sergey Romanenko
Expand Down
8 changes: 4 additions & 4 deletions views/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for entry in entries %}
{% for page in sitemap %}
<url>
<loc>{{ base_url() }}/{{ entry.slug }}</loc>
<lastmod>{{ entry.date }}</lastmod>
<changefreq>{% if entry.changefreq %}{{ entry.changefreq }}{% else %}1.0{% endif %}</changefreq>
<loc>{{ base_url() }}/{{ page.slug }}</loc>
<lastmod>{{ page.date }}</lastmod>
<changefreq>{% if page.changefreq %}{{ page.changefreq }}{% else %}1.0{% endif %}</changefreq>
<priority>1.0</priority>
</url>
{% endfor %}
Expand Down

0 comments on commit c0152ba

Please sign in to comment.