BlueSky’s lack of conformance and server-setup will cause this, and as you’ve discovered the solution with aligning TwigFeed’s cache_time
to make it behave is insufficient. The offending line is in Parser.php, used as a fallback for this lack of conformance. The parser-library’s getLastModified should handle pubDate
, but for the time being this looks like an edge-case with BlueSky that would need further debugging.
Thanks for the sort_by_key reminder, and updating the Obsidian-note, I’d forgotten if Twig can do datetime-parsing and comparison by itself. Seemingly not through the native |sort((a, b) => a.lastModified - b.lastModified)
.
retrievedTitle
is not a standardized property, but seemingly based on the pagination-example. My best guess would be misalignment between TwigFeed’s and Twig’s caching, but the use of the underlying properties feed.config.name
and name
shouldn’t be affected. A trick for debugging is to add in
echo '<script>window.twig_feeds = ' . json_encode($feed_items) . ';</script>';
before line 372 in twigfeeds.php, to view the actual data passed to Twig on runtime. That is taken directly from the raw data, cached or not. Beyond that, all cached data is in cache://twigfeeds
or user://data/twigfeeds
, and you’d have to compare if there are any changes to the files that manifest.json
refers to in order to discover unexpected variations between processing.
For posterity, the following is an example of flipping the feed-data to group and sort it by taxonomy. Grouping depends on a bit of pre-arranging of metadata:
{# Iterate and find unique tag-values #}
{% set twig_feeds_tags = [] %}
{% for name, feed in twig_feeds %}
{% for value in feed.config['tags'] %}
{% if value not in twig_feeds_tags %}
{% set twig_feeds_tags = twig_feeds_tags|merge([value]) %}
{% endif %}
{% endfor %}
{% endfor %}
{# Iterate and find unique category-values #}
{% set twig_feeds_categories = [] %}
{% for name, feed in twig_feeds %}
{% for value in feed.config['categories'] %}
{% if value not in twig_feeds_categories %}
{% set twig_feeds_categories = twig_feeds_categories|merge([value]) %}
{% endif %}
{% endfor %}
{% endfor %}
So that you could efficiently regroup, sort, and render them:
{% set twig_feeds_tags_items = [] %}
{% for value in twig_feeds_tags %}
{% set twig_feeds_filtered = twig_feeds|filter(v => value in v.config.tags) %}
{% set twig_feeds_filtered_items = [] %}
{% for name, feed in twig_feeds_filtered %}
{% set twig_feeds_filtered_items = twig_feeds_filtered_items|merge(feed.items) %}
{% endfor %}
<h4>{{ value }} ({{ print_r(twig_feeds_filtered_items|count) }})</h4>
{% for item in twig_feeds_filtered_items|sort_by_key('lastModified') %}
<time>{{ item.lastModified }}</time>
<small>
<a href="{{ item.link }}">{{ item.title|default(item.link) }}</a>
</small>
<br />
{% endfor %}
{% endfor %}