<?php
/**
 * Copyright © Magefan (support@magefan.com). All rights reserved.
 * Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
 *
 * Glory to Ukraine! Glory to the heroes!
 */

/**
 * Blog rss feed template
 *
 * @var $block \Magefan\Blog\Block\Rss\Feed
 */

$_postCollection = $block->getPostCollection();
echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\r\n";

?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
     version="2.0" >
<channel>
   <title><?= $block->escapeHtml($block->getTitle()) ?></title>
   <atom:link href="<?= $block->escapeUrl($block->getLink()) ?>" rel="self" type="application/rss+xml"/>
   <link><?= $block->escapeUrl($block->getLink()) ?></link>
   <description><?= $block->escapeHtml($block->getDescription()) ?></description>
    <?php foreach ($_postCollection as $_post) { ?>
   <item>
      <title><?= $block->escapeHtml($_post->getTitle()) ?></title>
      <link><?= $block->escapeUrl($_post->getPostUrl()) ?></link>
      <guid><?= $block->escapeUrl($_post->getPostUrl()) ?></guid>
      <description><![CDATA[<?= /*@noEscape*/ $block->getPostContent($_post) ?>]]></description>
        <?php /*if ($featuredImage = $_post->getFeaturedImage()) { ?>
         <image><?= $featuredImage ?></image>
      <?php }*/ ?>
      <pubDate><?= $block->escapeHtml($_post->getPublishDate('r')) ?></pubDate>
        <?php foreach ($_post->getParentCategories() as $category) { ?>
      <category><![CDATA[<?= $block->escapeHtml($category->getTitle()) ?>]]></category>
        <?php } ?>
   </item>
    <?php } ?>
</channel>
</rss>
