Files
gouki 57b6221d90
Build and Deploy / verify (push) Successful in 10s
Build and Deploy / deploy (push) Successful in 18s
feat: list mode 50/page, card mode left-image rows, AI cover generation command
- blog_paginate: 纯列表模式每页 50 条(list_per_page 可调),其余模式仍走 per_page
- 图文(card)模式:卡片网格改为左图右文横排,小屏回退竖排;摘要放宽到 100 字
- 新增 covers:generate:复用 AI 设置的 LLM 配置调 /image_generation(默认 image-01),
  为无封面文章批量生成封面存入 media cover 集合;支持 --all/--limit/--post/--style/--dry-run
- AI 设置页新增图片模型、封面风格两项配置
- 修正 HomeViewModeTest:列表模式为纯标题(不再显示摘要),并断言每页 50 条与图文布局
2026-10-13 23:58:15 +00:00

82 lines
4.1 KiB
PHP

@php
$viewMode = $homeViewMode ?? \App\Blog\Support\HomeViewMode::LIST;
$showFull = $viewMode === \App\Blog\Support\HomeViewMode::FULL
&& blank($post->read_password)
&& empty(($post->meta ?? [])['members_only']);
@endphp
@if($viewMode === \App\Blog\Support\HomeViewMode::CARD)
<article class="post-card post-card-card {{ $post->isPinned() ? 'sticky' : '' }}">
<a wire:navigate href="{{ route('posts.show', $post->id) }}" class="post-cover">
@if($url = $post->coverOrFirstImageUrl())
<img src="{{ $url }}" alt="{{ $post->title }}" loading="lazy">
@else
<span class="post-cover-placeholder">{{ \Illuminate\Support\Str::limit($post->title, 24, '') }}</span>
@endif
</a>
<div class="post-card-body">
<h2 class="post-title">
@if($label = $post->stickyLabel())<span class="badge">{{ $label }}</span>@endif
<a wire:navigate href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a>
</h2>
<div class="post-excerpt">{{ \Illuminate\Support\Str::limit($post->excerpt_or_fallback, 100) }}</div>
<div class="post-meta">
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format('Y-m-d') }}</time>
@if($post->category)
<span>·</span>
<a wire:navigate href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a>
@endif
</div>
</div>
</article>
@elseif($viewMode === \App\Blog\Support\HomeViewMode::LIST)
<article class="post-card post-card-list {{ $post->isPinned() ? 'sticky' : '' }}">
<h2 class="post-title">
@if($label = $post->stickyLabel())<span class="badge">{{ $label }}</span>@endif
<a wire:navigate href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a>
</h2>
<div class="post-meta">
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format(blog_setting('listtime', 'Y-m-d')) }}</time>
@if($post->category)
<span>·</span>
<a wire:navigate href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a>
@endif
</div>
</article>
@else
<article class="post-card {{ $post->isPinned() ? 'sticky' : '' }} post-card-{{ $viewMode }}">
@if($url = $post->coverImageUrl())
<a wire:navigate href="{{ route('posts.show', $post->id) }}" class="post-cover">
<img src="{{ $url }}" alt="{{ $post->title }}" loading="lazy">
</a>
@endif
<h2 class="post-title">
@if($label = $post->stickyLabel())<span class="badge">{{ $label }}</span>@endif
<a wire:navigate href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a>
</h2>
<div class="post-meta">
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format(blog_setting('normaltime', 'Y-m-d H:i')) }}</time>
@if($post->category)
<span>·</span>
<a wire:navigate href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a>
@endif
<span>· 阅读 {{ $post->views }}</span>
<span>· 评论 {{ $post->comment_count }}</span>
</div>
@if($showFull)
<div class="post-content">
{!! app(\App\Blog\Services\PostContentRenderer::class)->render($post) !!}
</div>
@else
<div class="post-excerpt">
{{ \Illuminate\Support\Str::limit($post->excerpt_or_fallback, 200) }}
</div>
@endif
<div class="post-footer">
<a wire:navigate href="{{ route('posts.show', $post->id) }}" class="read-more">阅读全文 &raquo;</a>
@foreach($post->tags as $tag)
<a wire:navigate href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
@endforeach
</div>
</article>
@endif