feat(feed): exclude unlisted posts from rss and json feeds
This commit is contained in:
@@ -36,8 +36,9 @@ permalink: "categories/{{ categoryFeed.slug }}/feed.json"
|
|||||||
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
},
|
},
|
||||||
|
{%- set listedCategoryPosts = categoryFeed.posts | excludeUnlistedPosts %}
|
||||||
"items": [
|
"items": [
|
||||||
{%- for post in categoryFeed.posts %}
|
{%- for post in listedCategoryPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ permalink: "categories/{{ categoryFeed.slug }}/feed.xml"
|
|||||||
<language>{{ site.locale | default('en') }}</language>
|
<language>{{ site.locale | default('en') }}</language>
|
||||||
<atom:link href="{{ site.url }}/categories/{{ categoryFeed.slug }}/feed.xml" rel="self" type="application/rss+xml"/>
|
<atom:link href="{{ site.url }}/categories/{{ categoryFeed.slug }}/feed.xml" rel="self" type="application/rss+xml"/>
|
||||||
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
||||||
<lastBuildDate>{{ categoryFeed.posts | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
{%- set listedCategoryPosts = categoryFeed.posts | excludeUnlistedPosts %}
|
||||||
{%- for post in categoryFeed.posts %}
|
{%- if listedCategoryPosts.length %}
|
||||||
|
<lastBuildDate>{{ listedCategoryPosts | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
||||||
|
{%- endif %}
|
||||||
|
{%- for post in listedCategoryPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ eleventyImport:
|
|||||||
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
},
|
},
|
||||||
|
{%- set listedFeedPosts = collections.feed | excludeUnlistedPosts %}
|
||||||
"items": [
|
"items": [
|
||||||
{%- for post in collections.feed %}
|
{%- for post in listedFeedPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
7
feed.njk
7
feed.njk
@@ -14,8 +14,11 @@ eleventyImport:
|
|||||||
<language>{{ site.locale | default('en') }}</language>
|
<language>{{ site.locale | default('en') }}</language>
|
||||||
<atom:link href="{{ site.url }}/feed.xml" rel="self" type="application/rss+xml"/>
|
<atom:link href="{{ site.url }}/feed.xml" rel="self" type="application/rss+xml"/>
|
||||||
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
||||||
<lastBuildDate>{{ collections.feed | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
{%- set listedFeedPosts = collections.feed | excludeUnlistedPosts %}
|
||||||
{%- for post in collections.feed %}
|
{%- if listedFeedPosts.length %}
|
||||||
|
<lastBuildDate>{{ listedFeedPosts | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
||||||
|
{%- endif %}
|
||||||
|
{%- for post in listedFeedPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ permalink: "categories/{{ categoryFeed.slug }}/feed.json"
|
|||||||
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
},
|
},
|
||||||
|
{%- set listedCategoryPosts = categoryFeed.posts | excludeUnlistedPosts %}
|
||||||
"items": [
|
"items": [
|
||||||
{%- for post in categoryFeed.posts %}
|
{%- for post in listedCategoryPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ permalink: "categories/{{ categoryFeed.slug }}/feed.xml"
|
|||||||
<language>{{ site.locale | default('en') }}</language>
|
<language>{{ site.locale | default('en') }}</language>
|
||||||
<atom:link href="{{ site.url }}/categories/{{ categoryFeed.slug }}/feed.xml" rel="self" type="application/rss+xml"/>
|
<atom:link href="{{ site.url }}/categories/{{ categoryFeed.slug }}/feed.xml" rel="self" type="application/rss+xml"/>
|
||||||
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
||||||
<lastBuildDate>{{ categoryFeed.posts | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
{%- set listedCategoryPosts = categoryFeed.posts | excludeUnlistedPosts %}
|
||||||
{%- for post in categoryFeed.posts %}
|
{%- if listedCategoryPosts.length %}
|
||||||
|
<lastBuildDate>{{ listedCategoryPosts | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
||||||
|
{%- endif %}
|
||||||
|
{%- for post in listedCategoryPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ eleventyImport:
|
|||||||
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
"support": {{ site.support | textcastingSupport | jsonEncode | safe }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
},
|
},
|
||||||
|
{%- set listedFeedPosts = collections.feed | excludeUnlistedPosts %}
|
||||||
"items": [
|
"items": [
|
||||||
{%- for post in collections.feed %}
|
{%- for post in listedFeedPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ eleventyImport:
|
|||||||
<language>{{ site.locale | default('en') }}</language>
|
<language>{{ site.locale | default('en') }}</language>
|
||||||
<atom:link href="{{ site.url }}/feed.xml" rel="self" type="application/rss+xml"/>
|
<atom:link href="{{ site.url }}/feed.xml" rel="self" type="application/rss+xml"/>
|
||||||
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
<atom:link href="https://websubhub.com/hub" rel="hub"/>
|
||||||
<lastBuildDate>{{ collections.feed | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
{%- set listedFeedPosts = collections.feed | excludeUnlistedPosts %}
|
||||||
{%- for post in collections.feed %}
|
{%- if listedFeedPosts.length %}
|
||||||
|
<lastBuildDate>{{ listedFeedPosts | getNewestCollectionItemDate | dateToRfc822 }}</lastBuildDate>
|
||||||
|
{%- endif %}
|
||||||
|
{%- for post in listedFeedPosts %}
|
||||||
{%- set absolutePostUrl = site.url + post.url %}
|
{%- set absolutePostUrl = site.url + post.url %}
|
||||||
{%- set postImage = post.data.photo %}
|
{%- set postImage = post.data.photo %}
|
||||||
{%- if postImage %}
|
{%- if postImage %}
|
||||||
|
|||||||
Reference in New Issue
Block a user