Skip to content

Commit 0519668

Browse files
committed
✨ added xls for sitemap
- human readable version of sitemap - can be used to pre-generate images based on xls in https://github.com/omz13/kirby3-xmlsitemap by @omz13
1 parent 6df72d3 commit 0519668

File tree

8 files changed

+153
-80
lines changed

8 files changed

+153
-80
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ If you use these defaults you need to provide the fields `date (type: date)` and
131131

132132
```php
133133
[
134+
'xsl' => true,
134135
'urlfield' => 'url',
135136
'modified' => time(),
136137
'snippet' => 'feed/sitemap'
@@ -168,6 +169,17 @@ return [
168169
return $feed;
169170
}
170171
],
172+
// (optional) Add stylesheet for human readable version of the xml file.
173+
// With that stylesheet visiting the xml in a browser will per-generate the images.
174+
// The images will NOT be pre-generated if the xml file is downloaded (by google).
175+
[
176+
'pattern' => 'sitemap.xsl',
177+
'method' => 'GET',
178+
'action' => function () {
179+
snippet('feed/sitemapxsl');
180+
die;
181+
}
182+
],
171183
],
172184
];
173185
```

classes/Feed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public function optionsFromDefault(?Pages $pages = null, $options = []): array
130130
'mime' => null,
131131
'sort' => true,
132132
// sitemap
133+
'xsl' => true,
133134
'images' => false,
134135
'imagesfield' => 'images',
135136
'imagetitlefield' => 'title',
@@ -173,8 +174,7 @@ public function response(): Response
173174

174175
if ($mime !== null) {
175176
return new Response($this->string, $mime);
176-
}
177-
elseif ($snippet === 'feed/sitemap' && Feed::isXml($this->string)) {
177+
} elseif ($snippet === 'feed/sitemap' && Feed::isXml($this->string)) {
178178
return new Response($this->string, 'xml');
179179
} elseif ($snippet === 'feed/json' || Feed::isJson($this->string)) {
180180
return new Response($this->string, 'json');

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bnomei/kirby3-feed",
33
"type": "kirby-plugin",
4-
"version": "1.4.4",
4+
"version": "1.5.0",
55
"description": "Generate a RSS/JSON/Sitemap-Feed from a Pages-Collection",
66
"license": "MIT",
77
"authors": [

composer.lock

Lines changed: 57 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)