How to read RSS news on Blazor WebAssembly ?

Recently I got the chance to implement google RSS news on one of my Blazor Webassembly project. It is very simple to implement using System.ServiceModel.Syndication package

Step 1: Create the Class like

 public class NewsItem
        public string NewsTitle { get; set; } = "";
        public string NewsLink { get; set; } = "";
        public DateTime PubishDate { get; set; }


Step2: Create the Web API controller and write the method for reading RSS like this

        public List<NewsItem> GetNewsFeedData() 
            List<NewsItem> newsItems = new List<NewsItem>();
            List<NewsItem> healthData = new List<NewsItem>();

            string url = "";
            newsItems = FetchRssFeedData(url);

            string healthrssPath = "'health'";
            healthData= FetchRssFeedData(healthrssPath);
            var combineList = newsItems.Concat(healthData).ToList();
            var result= (from m in combineList orderby m.PubishDate descending
                        select m).ToList();
            return result;

 public List<NewsItem> FetchRssFeedData(string path)
            List<NewsItem> NewsDrugs = new List<NewsItem>();
            XmlReader reader = XmlReader.Create(path);
            SyndicationFeed feed = SyndicationFeed.Load(reader);
            foreach (SyndicationItem item in feed.Items)
                NewsItem newsItem = new();
                newsItem.NewsTitle = item.Title.Text;
                newsItem.NewsLink = item.Links[0].Uri.ToString();
                newsItem.PubishDate = (DateTime)item.PublishDate.UtcDateTime;
            return NewsDrugs;

Step 3: Consume on this api on Razor page like

@if (NewsDrugs != null)
    @foreach (var item in NewsDrugs)
        <div class="container">
            <div class="row">
              <a href="@item.NewsLink" target="_blank" rel="noopener noreferrer">@item.NewsTitle</a>
            <div class="row">
                <b>PubishDate : </b> @item.PubishDate.ToString("MM/dd/yyyy")
            <hr />

@code {
    public List<NewsItem> NewsDrugs { get; set; }

    protected override async Task OnInitializedAsync()
        NewsDrugs = await DiseaseDrugRepository.GetNewsItems();
        await base.OnInitializedAsync();

Note: For Blazor Server, no need to create web api layer, you can directly write on your razor page.