1- # Kirby 3 Feed
1+ # Kirby 3 Feed and Sitemap
22
33![ Release] ( https://flat.badgen.net/packagist/v/bnomei/kirby3-feed?color=ae81ff )
44![ Downloads] ( https://flat.badgen.net/packagist/dt/bnomei/kirby3-feed?color=272822 )
77[ ![ Maintainability] ( https://flat.badgen.net/codeclimate/maintainability/bnomei/kirby3-feed )] ( https://codeclimate.com/github/bnomei/kirby3-feed )
88[ ![ Twitter] ( https://flat.badgen.net/badge/twitter/bnomei?color=66d9ef )] ( https://twitter.com/bnomei )
99
10- Generate a RSS/JSON-Feed from a Pages-Collection.
10+ Generate a RSS/JSON/Sitemap -Feed from a Pages-Collection.
1111
1212## Commercial Usage
1313
@@ -16,13 +16,21 @@ This plugin is free but if you use it in a commercial project please consider to
1616- [ buy me ☕] ( https://buymeacoff.ee/bnomei ) or
1717- [ buy a Kirby license using this affiliate link] ( https://a.paddle.com/v2/click/1129/35731?link=1170 )
1818
19+
20+ ## Similar Plugins
21+
22+ - [ kirby3-xmlsitemap] ( https://github.com/omz13/kirby3-xmlsitemap )
23+ - [ kirby3-feeds] ( https://github.com/omz13/kirby3-feeds )
24+
25+ > both have not seen any updates since April 2019
26+
1927## Installation
2028
2129- unzip [ master.zip] ( https://github.com/bnomei/kirby3-feed/archive/master.zip ) as folder ` site/plugins/kirby3-feed ` or
2230- ` git submodule add https://github.com/bnomei/kirby3-feed.git site/plugins/kirby3-feed ` or
2331- ` composer require bnomei/kirby3-feed `
2432
25- ## Usage
33+ ## Usage Feed
2634
2735You can use this in a template for a dedicated feed page, in a template controller or a route.
2836
@@ -75,8 +83,8 @@ return [
7583 $feed = page('blog')->children()->listed()->flip()->limit(10)->feed($options);
7684 return $feed;
7785 }
78- ]
79- ]
86+ ],
87+ ],
8088];
8189```
8290
@@ -109,6 +117,55 @@ $feed = page('blog')->children()->listed()->sortBy(function ($page) {
109117}, 'desc')->limit(10)->feed($options);
110118```
111119
120+ ## Usage Sitemap
121+
122+ ** options array defaults**
123+
124+ If you use these defaults you need to provide the fields ` date (type: date) ` and ` text (type: text) ` .
125+
126+ ``` php
127+ [
128+ 'urlfield' => 'url',
129+ 'titlefield' => 'title',
130+ 'textfield' => 'text',
131+ 'modified' => time(),
132+ 'snippet' => 'feed/sitemap'
133+ 'mime' => null,
134+ 'sort' => true,
135+ ]
136+ ```
137+
138+ ** virtual page in site/config.php**
139+
140+ ``` php
141+ return [
142+ 'routes' => [
143+ // ... other routes,
144+ [
145+ 'pattern' => 'sitemap.xml',
146+ 'method' => 'GET',
147+ 'action' => function () {
148+ $options = [
149+ 'images' => false,
150+ 'videos' => false,
151+ ];
152+ $feed = site()->index()->listed()->limit(50000)->sitemap($options);
153+ return $feed;
154+ }
155+ ],
156+ ],
157+ ];
158+ ```
159+
160+ ** example for excluding pages from sitemap**
161+
162+ see [ Kirby Docs -Filtering compendium] ( https://getkirby.com/docs/cookbook/content/filtering )
163+
164+ ``` php
165+ $feed = site()->index()->listed()->filterBy('template', '!=', 'excludeme')->limit(50000)->sitemap($options);
166+ ```
167+
168+
112169## Settings
113170
114171| bnomei.feed. | Default | Description |
0 commit comments