Skip to content

Commit b813ab3

Browse files
committed
Feed 1.0.0
1 parent b7ceed7 commit b813ab3

File tree

7 files changed

+15
-32
lines changed

7 files changed

+15
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# v1.0.0, 2021-01-11
1+
# v1.0.0, 2021-01-15
22
* Initial release

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1 align="center">Feed Plugin for <a href="https://flextype.org/">Flextype</a></h1>
22

33
<p align="center">
4-
<a href="https://github.com/flextype-plugins/feed/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/feed.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/feed"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/feed"><img src="https://img.shields.io/github/downloads/flextype-plugins/feed/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.15-green.svg?color=black" alt="Flextype"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&color=black&label=Discord%20Chat" alt="Discord"></a>
4+
<a href="https://github.com/flextype-plugins/feed/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/feed.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/feed"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/feed"><img src="https://img.shields.io/github/downloads/flextype-plugins/feed/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.16-green.svg?color=black" alt="Flextype"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&color=black&label=Discord%20Chat" alt="Discord"></a>
55
</p>
66

77
Feed plugin for Flextype supports Atom 1.0, RSS and JSON feed types and allows you to generate feeds for entries.
@@ -12,7 +12,7 @@ The following dependencies need to be downloaded and installed for Feed Plugin.
1212

1313
| Item | Version | Download |
1414
|---|---|---|
15-
| [flextype](https://github.com/flextype/flextype) | 0.9.15 | [download](https://github.com/flextype/flextype/releases) |
15+
| [flextype](https://github.com/flextype/flextype) | 0.9.16 | [download](https://github.com/flextype/flextype/releases) |
1616
| [twig](https://github.com/flextype-plugins/twig) | >=2.0.0 | [download](https://github.com/flextype-plugins/twig/releases) |
1717

1818
## Installation
@@ -33,7 +33,7 @@ The following dependencies need to be downloaded and installed for Feed Plugin.
3333

3434
### Usage
3535

36-
Inside `project/config/plugins/feed/settings.yaml` you may create unlimited feed for you entries.
36+
In `project/config/plugins/feed/settings.yaml` you may create unlimited feed for you entries.
3737

3838
Lets create RSS, ATOM and JSON feed for blog collection:
3939

@@ -45,7 +45,6 @@ feed:
4545
title: Blog
4646
description: Blog description
4747
collection: true
48-
length: 400
4948
format: rss
5049
route: '/blog.rss'
5150
blog-atom:
@@ -54,7 +53,6 @@ feed:
5453
title: Blog
5554
description: Blog description
5655
collection: true
57-
length: 400
5856
format: json
5957
route: '/blog.atom'
6058
blog-json:
@@ -63,7 +61,6 @@ feed:
6361
title: Blog
6462
description: Blog description
6563
collection: true
66-
length: 400
6764
format: json
6865
route: '/blog.json'
6966
```

plugin.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,15 @@
66
$feed = flextype('registry')->get('plugins.feed.settings.feed');
77

88
if (isset($feed) and count($feed) > 0) {
9-
foreach (flextype('registry')->get('plugins.feed.settings.feed') as $item) {
9+
foreach ($feed as $item) {
1010

1111
$cacheID = strings('feed-collection-' . $item['id'])->hash()->toString();
1212

13-
flextype('emitter')->addListener('onEntriesCreate', function () use ($cacheID) {
14-
flextype('cache')->delete($cacheID);
15-
});
16-
17-
flextype('emitter')->addListener('onEntriesDelete', function () use ($cacheID) {
18-
flextype('cache')->delete($cacheID);
19-
});
20-
21-
flextype('emitter')->addListener('onEntriesMove', function () use ($cacheID) {
22-
flextype('cache')->delete($cacheID);
23-
});
24-
25-
flextype('emitter')->addListener('onEntriesCopy', function () use ($cacheID) {
26-
flextype('cache')->delete($cacheID);
27-
});
28-
29-
flextype('emitter')->addListener('onEntriesUpdate', function () use ($cacheID) {
30-
flextype('cache')->delete($cacheID);
31-
});
13+
flextype('emitter')->addListener('onEntriesCreate', fn () => flextype('cache')->delete($cacheID));
14+
flextype('emitter')->addListener('onEntriesDelete', fn () => flextype('cache')->delete($cacheID));
15+
flextype('emitter')->addListener('onEntriesMove', fn () => flextype('cache')->delete($cacheID));
16+
flextype('emitter')->addListener('onEntriesCopy', fn () => flextype('cache')->delete($cacheID));
17+
flextype('emitter')->addListener('onEntriesUpdate', fn () => flextype('cache')->delete($cacheID));
3218

3319
flextype()->get($item['options']['route'], function (Request $request, Response $response, array $args) use ($item, $cacheID) {
3420

plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 1.0.0
33
description: Feed plugin for Flextype
44
author:
55
name: Sergey Romanenko
6-
email: awilum@yandex.ru
6+
email: sergey.romanenko@flextype.org
77
url: https://flextype.org
88
homepage: https://github.com/flextype-plugins/feed
99
documentation: https://github.com/flextype-plugins/feed
@@ -15,5 +15,5 @@ icon:
1515
license: MIT
1616

1717
dependencies:
18-
flextype: 0.9.15
18+
flextype: 0.9.16
1919
twig: '>=2.0.0'

templates/feed.atom.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<link href="{{ url() }}/{{ entry.id }}"/>
3333
<content type="html">
3434
<![CDATA[
35-
{{ strings(entry.content).limit(item.options.length).toString()|shortcode|markdown|raw }}
35+
{{ entry.content|shortcode|markdown|raw }}
3636
]]>
3737
</content>
3838
</entry>

templates/feed.json.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
{% set itemList = [] %}
1414
{% for entry in entries %}
15-
{%- set content_html = strings(entry.content).limit(item.options.length).toString()|shortcode|markdown|raw -%}
15+
{%- set content_html = entry.content|shortcode|markdown|raw -%}
1616
{%- set post = {
1717
"title": entry.title|e,
1818
"date_published": entry.published_at|date('Y-m-d\\TH:i:sP'),

templates/feed.rss.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<pubDate>{{ entry.published_at|date('D, d M Y H:i:s O') }}</pubDate>
2727
<description>
2828
<![CDATA[
29-
{{ strings(entry.content).limit(item.options.length).toString()|shortcode|markdown|raw }}
29+
{{ entry.content|shortcode|markdown|raw }}
3030
]]>
3131
</description>
3232
</item>

0 commit comments

Comments
 (0)