Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Add custom element in Syndication Item or AtomEntry is impossible #48

Open
MTerance opened this issue Apr 23, 2020 · 0 comments
Open

Add custom element in Syndication Item or AtomEntry is impossible #48

MTerance opened this issue Apr 23, 2020 · 0 comments

Comments

@MTerance
Copy link

MTerance commented Apr 23, 2020

Unlike in the exemple RssWriteItemWithCustomElementExample.cs,
AtomEntry and SindicationItem inherit from ISyndicationItem.

when i want to add a custom element like a balise <enclosure> in my element <entry>,
after passing the formatter , my new elemnt is not displayed in the result :

                var item = new AtomEntry
                {
                    Title = post.Title,
                    Description = post.Content,
                    Id = $"{host}/posts/{post.Slug}",
                    Published = post.Published,
                    LastUpdated = post.Published,
                    ContentType = "html",
                };

item.AddContributor(new SyndicationPerson(post.Author.DisplayName, post.Author.Email));
                item.AddLink(new SyndicationLink(new Uri(item.Id)));

var content = new SyndicationContent(_formatter.Format(item));
content.AddField(new SyndicationContent("enclosure",  "linkToMyMp3.mp3"));


In the displayed result , the element enclosure created earlier is missing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant