Skip to content

Add support for sorting the feed #2

@AshleyButcher

Description

@AshleyButcher

Not all feed generators are kind enough to order items in a logical order, and not all feeds are in the order required for consumption on a site.

To this end, it would be useful to support the sort attribute on the feed tag in the same manner as with standard Textpattern list tags (such as category_list).

Ideally this would be possible as a part of the XPath query, however XPath 3.1 functions like fn:sort are not available via PHP's SimpleXML since it's just using libxml2 (= XPath 1.0).

Problems to overcome:

  • The way items are output will need to be refactored to add an intermediary stage when sorting is active which would need to convert the XML into an array for a sort/multisort operation prior to output.
  • Sorting on custom fields will likely need to have the limitation of only being on tag level (not attributes)
  • Sorting on common fields such as the publication date (probably the most common use case) will need to have a common alias as different feed formats have different naming (RSS vs. Atom as the obvious example).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions