Skip to content

Support multiple feed-level links and emit Atom rel="self" - #69

Merged
Grotax merged 4 commits into
mainfrom
copilot/support-multiple-feed-links
Jun 3, 2026
Merged

Grotax merged 4 commits into
mainfrom
copilot/support-multiple-feed-links

Conversation

Copilot AI commented May 24, 2026 •

Copy link
Copy Markdown

Feed-level links were modeled as a single setLink() value, making it impossible to represent both a homepage (rel="alternate") and a canonical feed URL (rel="self") — a requirement for valid Atom feeds.

New API

  • FeedIo\Feed\Node\FeedLink — value object with rel, href, type
  • Feed::addLink(string $rel, string $href, ?string $type) — appends to an explicit link collection
  • Feed::getLinks(): iterable — iterates all explicit links
  • Feed::setHomePageUrl(string $url) / getHomePageUrl() — convenience alias over setLink() + addLink('alternate', ..., 'text/html')
  • Feed::setFeedUrl(string $url) / getFeedUrl() — convenience alias over setUrl() + addLink('self', ..., 'application/atom+xml')

Atom formatting

Rule\Atom\LinkNode::addElement() now emits per-link <link rel="..." href="..." type="..."/> elements when the feed has an explicit links collection. Falls back to the existing single <link href="..."/> behavior when none are present.

// New convenience API
$feed->setHomePageUrl('https://example.com/');
$feed->setFeedUrl('https://example.com/feed.atom');

// Or explicit control
$feed->addLink('alternate', 'https://example.com/', 'text/html');
$feed->addLink('self', 'https://example.com/feed.atom', 'application/atom+xml');

Atom output:

<link rel="alternate" href="https://example.com/" type="text/html"/>
<link rel="self" href="https://example.com/feed.atom" type="application/atom+xml"/>

Backward compatibility

setLink() behavior is unchanged. The multi-link path is only activated when addLink() (or the new convenience methods) are used.

Copilot AI linked an issue May 24, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Support multiple feed-level links and emit Atom rel="self" Support multiple feed-level links and emit Atom rel="self" May 24, 2026
Copilot finished work on behalf of Grotax May 24, 2026 06:46
Copilot AI requested a review from Grotax May 24, 2026 06:46
@Grotax
Grotax force-pushed the copilot/support-multiple-feed-links branch from 4c3d4eb to 0fe3c7b Compare June 3, 2026 08:09
@Grotax
Grotax marked this pull request as ready for review June 3, 2026 08:15
@Grotax
Grotax merged commit 7590b3f into main Jun 3, 2026
9 checks passed
@Grotax
Grotax deleted the copilot/support-multiple-feed-links branch June 3, 2026 08:16
@Grotax Grotax mentioned this pull request Jun 25, 2026
Grotax added a commit that referenced this pull request Jun 27, 2026
Changed
- Add support for multiple feed-level links and Atom feed link emission, including rel="self" and rel="alternate" handling. (#69)

Fixed
- Fix host extraction for relative-path URLs by guarding missing URL schemes in node handling. (#74)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple feed-level links and emit Atom rel="self"

2 participants