# How can I add a custom atom:link entry to a feed?

**URL:** <https://discourse.laminas.dev/t/how-can-i-add-a-custom-atom-link-entry-to-a-feed/2457>\
**Category:** Components & MVC\
**Tags:** laminas-feed\
**Created:** [August 20, 2021, 1:49pm UTC](https://discourse.laminas.dev/t/how-can-i-add-a-custom-atom-link-entry-to-a-feed/2457 "2021-08-20T13:49:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![podcasthosting](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/podcasthosting/32/1098_2.png) [@podcasthosting](https://discourse.laminas.dev/u/podcasthosting)\
**Post date:** [August 20, 2021, 1:49pm UTC](https://discourse.laminas.dev/t/how-can-i-add-a-custom-atom-link-entry-to-a-feed/2457/1 "2021-08-20T13:49:19Z")

</div>

Hi there,

thank you for this great package!

One thing I could not figure out is how to add a custom atom:link entry to a feed?

I want to add entry like this :

\<atom:link href=“[https://www.example.org](https://www.example.org)” rel=“alternate” type=“text/html”/\>

Any ideas are welcome. Thank you.

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [August 20, 2021, 2:39pm UTC](https://discourse.laminas.dev/t/how-can-i-add-a-custom-atom-link-entry-to-a-feed/2457/2 "2021-08-20T14:39:13Z")

</div>

Hello and welcome to our forums! 😃

> [@podcasthosting](#):
>
> I want to add entry like this :
> 
> \<atom:link href=“[https://www.example.org](https://www.example.org)” rel=“alternate” type=“text/html”/\>

Add a link to the entry:

```php
$entry->setLink('http://www.example.com/article');

```

This will produce:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <!-- … -->
    <entry>
        <link rel="alternate" type="text/html" href="http://www.example.com/article"/>
        <!-- … -->
    </entry>
</feed>

```

This is the same as:

```xml
<?xml version="1.0" encoding="utf-8"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
    <!-- … -->
    <atom:entry>
        <atom:link rel="alternate" type="text/html" href="http://www.example.com/article"/>
        <!-- … -->
    </atom:entry>
</atom:feed>

```

[But you can avoid the namespace.](https://validator.w3.org/feed/docs/warning/AvoidNamespacePrefix.html)

> <https://github.com/laminas/laminas-feed/blob/7033944e47ecf3e3535574029291434ba76d179d/src/Writer/Renderer/Entry/Atom.php#L240-L251>

---

<div class="post-metadata">

**Author:** ![podcasthosting](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/podcasthosting/32/1098_2.png) [@podcasthosting](https://discourse.laminas.dev/u/podcasthosting)\
**Post date:** [August 23, 2021, 5:26pm UTC](https://discourse.laminas.dev/t/how-can-i-add-a-custom-atom-link-entry-to-a-feed/2457/3 "2021-08-23T17:26:26Z")

</div>

Thank you @froschdesign !

I guess I forgot to mention that I export the feed in RSS format (for podcasts) and that I want multiple links. It seems I can have only one link and it exports as this:

`<link>https://www.example.org</link>`

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [August 24, 2021, 8:55am UTC](https://discourse.laminas.dev/t/how-can-i-add-a-custom-atom-link-entry-to-a-feed/2457/4 "2021-08-24T08:55:31Z")

</div>

> [@podcasthosting](#):
>
> I export the feed in RSS format (for podcasts) and that I want multiple links.

Do mean [Apple Podcasts](https://help.apple.com/itc/podcasts_connect/#/itcb54353390)? It is based on RSS 2.0 and only one link element is allowed here.

Do you have concrete use case for more than one link? Is there a reader or player that understands multiple links?

---

<div class="post-metadata">

**Author:** ![podcasthosting](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/podcasthosting/32/1098_2.png) [@podcasthosting](https://discourse.laminas.dev/u/podcasthosting)\
**Post date:** [August 24, 2021, 9:02am UTC](https://discourse.laminas.dev/t/how-can-i-add-a-custom-atom-link-entry-to-a-feed/2457/5 "2021-08-24T09:02:21Z")

</div>

> [@podcasthosting](#):
>
> \<atom:link href=“[https://www.example.org](https://www.example.org)” rel=“alternate” type=“text/html”/\>

That is why I asked for the link with the atom prefix. It should allow more than one.

I want to use it internally to pass on locations where the podcast can be found / subscribed to (podcast portals and aggregators).
