Files
laralog/resources/views/feed/rss.blade.php
T
gouki f5987e7cc2
Build and Deploy / verify (push) Successful in 1m6s
Build and Deploy / deploy (push) Successful in 41s
refactor(routes): canonical URLs now match sablog format exactly
- /show-{id}.shtml (comments page: /show-{id}-{page}.shtml)
- /category-{cid}.shtml / /category-{cid}-{page}.shtml
- /archives-{YYYYMM}.shtml / /archives-{YYYYMM}-{page}.shtml
- /tag/{name}, /tagslist.shtml, /index-{page}.shtml
- slug 时代的 /posts/{slug} 等旧格式全部 301 到 sablog 格式
2026-09-09 21:21:07 +00:00

33 lines
1.5 KiB
PHP

{!! $xmlDeclaration !!}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{{ $siteName }}</title>
<link>{{ url('/') }}</link>
<description>{{ $siteDescription }}</description>
<language>zh-CN</language>
<atom:link href="{{ route('feed.rss') }}" rel="self" type="application/rss+xml"/>
<lastBuildDate>{{ now()->toRssString() }}</lastBuildDate>
@foreach($posts as $post)
<item>
<title>{{ $post->title }}</title>
<link>{{ route('posts.show', $post->id) }}</link>
<guid isPermaLink="true">{{ route('posts.show', $post->id) }}</guid>
<pubDate>{{ $post->published_at->toRssString() }}</pubDate>
<description>{{ Str::limit(strip_tags($post->excerpt_or_fallback), 300) }}</description>
@if($post->category)
<category>{{ $post->category->name }}</category>
@endif
@foreach($post->tags as $tag)
<category>{{ $tag->name }}</category>
@endforeach
@if($post->author)
<author>{{ $post->author->email }} ({{ $post->author->name }})</author>
@endif
<content:encoded><![CDATA[
{!! app(\App\Blog\Services\PostContentRenderer::class)->render($post) !!}
]]></content:encoded>
</item>
@endforeach
</channel>
</rss>