Skip to content

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

Closed

Description

@Grotax

Problem

Feed-level links are currently modeled as a single value (setLink()), which makes it hard to represent both:

  1. Homepage link (rel="alternate")
  2. Canonical feed URL (rel="self")

Atom consumers and validators commonly expect a self link for the feed.

Expected behavior

  1. First-class support for both homepage URL and feed URL.
  2. Support multiple feed-level links with relation metadata.
  3. Atom output should emit at least one rel="self" link when feed URL is known.

Example Atom output

<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Example Feed</title>
  <link rel="alternate" href="https://example.com/" type="text/html"/>
  <link rel="self" href="https://example.com/feed.atom" type="application/atom+xml"/>
</feed>

Suggested API

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

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

Backward compatibility

  1. Keep setLink() behavior unchanged for existing users.
  2. Prefer explicit link collection when new API is used.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions