Boilerplate to use a Directus Instance to Build a Custom Website, Content will be Manage by Directus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

3 years ago
  1. @inject('markdownHelper', 'App\Helpers\MarkdownHelper')
  2. @php
  3. if (isset($_SERVER['HTTPS'])) {
  4. $http = 'https';
  5. } else {
  6. $http = 'http';
  7. }
  8. $base_url = $http.'://'.$_SERVER['SERVER_NAME'];
  9. @endphp
  10. <?xml version="1.0" encoding="utf-8"?>
  11. <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  12. <channel>
  13. <title>{{ $site['data']['title'] }}</title>
  14. <atom:link href="{{ $base_url }}/feed" rel="self" type="application/rss+xml" />
  15. <link>{{ $base_url }}/blog</link>
  16. <description>{{ $site['data']['description'] }}</description>
  17. <lastBuildDate>{{ date(DATE_RSS) }}</lastBuildDate>
  18. <language>{{ $_ENV['APP_LOCALE'] }}-{{ strtoupper($_ENV['APP_LOCALE']) }}</language>
  19. @foreach($posts['data'] as $post)
  20. <item>
  21. <title>{{ $post['title'] }}</title>
  22. <link>{{ $base_url.'/blog/'.$post['slug'] }}</link>
  23. <pubDate>{{ date(DATE_RSS, strtotime($post['published_at'])) }}</pubDate>
  24. <description>
  25. <![CDATA[
  26. {!! $markdownHelper->parse($post['lead']) !!}
  27. {!! $markdownHelper->parse($post['content']) !!}
  28. ]]>
  29. </description>
  30. <guid isPermaLink="false">{{ $post['slug'] }}</guid>
  31. </item>
  32. @endforeach
  33. </channel>
  34. </rss>