<?php header('Access-Control-Allow-Origin: *'); ?>
<?xml version="1.0" encoding="UTF-8"?>
<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:media="http://search.yahoo.com/mrss/">

  <channel>
    <title>NH Gooi Nieuws</title>
    <description>Nieuws uit het Gooi</description>
    <link>https://nhgooi.nl</link>
    <language>nl-nl</language>

    <atom:link rel="self" href="{{$url}}?page={{$page}}"/>
    <atom:link rel="first" href="{{$url}}?page=1"/>
    <atom:link rel="next" href="{{$url}}?page={{$page + 1}}"/>
@if($page != 1)
    <atom:link rel="previous" href="{{$url}}?page={{$page - 1}}"/>
@endif

    @foreach($news as $item)
    <item>
        <guid>https://nhgooi.nl/news-{{$item->id}}</guid>
        <title><![CDATA[{!!html_entity_decode($item->title)!!}]]></title>
        <description><![CDATA[{!!html_entity_decode($item->content)!!}]]></description>
        <link>https://nhgooi.nl{{$item->url}}</link>
        <pubDate>{{$item->published->format('r')}}</pubDate>
	@if($item->images)
	<media:group>
	@foreach($item->images as $image)
		<media:content medium="image" url="https://nhgooi.nl{{$image->url}}" type="image/jpeg" />
	@endforeach
	</media:group>
	@endif
    </item> 
    @endforeach
       
  </channel>
</rss>

