<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rss version="2.0" 
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title>{{ $data['channel']['title'] }}</title>
        <atom:link href="{{ $data['channel']['atomlink'] }}" rel="self" type="application/rss+xml"/>
        <link>{{ $data['channel']['link'] }}</link>
        <language>{{ $data['channel']['language'] }}</language>
        <pubDate>{{ $data['channel']['build_date'] }}</pubDate>
        <lastBuildDate>{{ $data['channel']['build_date'] }}</lastBuildDate>
        <description>{!! $data['channel']['description'] !!}</description>
        <generator>{{ $data['channel']['name'] }}</generator>
        <sy:updatePeriod>hourly</sy:updatePeriod>
        <sy:updateFrequency>1</sy:updateFrequency>
        @foreach ($data['items'] as $item)
        <item>
            <title>{{ $item['title'] }}</title>
            <link>{{ $item['link'] }}</link>
            <comments>{{ $item['comment_link'] }}</comments>
            <pubDate>{{ $item['pub_date'] }}</pubDate>
            <dc:creator>{{ $item['creator'] }}</dc:creator>
            <guid isPermaLink="true">{{ $item['link'] }}</guid>
            <description>
                <![CDATA[ 
                    @if (isset($item['image_url']) && $item['image_url'])
                    <p><img src="{{ $item['image_url'] }}"></p>
                    @endif
                    {!! $item['description'] !!} 
                ]]>
            </description>
            @if (isset($item['image_url']) && $item['image_url'])
            <enclosure url="{{ $item['image_url'] }}" type="image/{{ pathinfo($item['image_url'], PATHINFO_EXTENSION) }}" length="{{ rand(1000,200000) }}"/>
            @endif
            <content:encoded>
                <![CDATA[ 
                    @if (isset($item['image_url']) && $item['image_url'])
                    <p><img src="{{ $item['image_url'] }}"></p>
                    @endif
                    {!! $item['content'] !!} 
                ]]>
            </content:encoded>
        </item>
        @endforeach
    </channel>
</rss>
