Files
cloud-chip.cn/resources/views/articles/show.blade.php
T
2026-08-08 18:27:38 +08:00

59 lines
2.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('layouts.app')
@php $siteName = App\Models\Setting::get('site_name', '深圳市云创芯电子有限公司'); @endphp
@section('title', $article->seoTitle() . ' - ' . $siteName)
@section('description', $article->seoDescription())
@section('content')
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
<div class="mx-auto max-w-3xl">
<nav class="mb-6 flex items-center gap-1.5 text-sm text-muted">
<a href="{{ url('/') }}" class="hover:text-primary">首页</a>
<span>/</span>
<a href="{{ route('articles.index') }}" class="hover:text-primary">技术文章</a>
<span>/</span>
<span class="text-fg">{{ $article->title }}</span>
</nav>
@if ($article->template === 'feature' && $article->cover)
<div class="mb-6 overflow-hidden rounded-lg border border-line">
<img src="{{ $article->cover }}" alt="{{ $article->title }}" class="max-h-96 w-full object-cover">
</div>
@endif
<article class="rounded-lg border border-line bg-surface p-6 shadow-soft sm:p-8">
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">{{ $article->title }}</h1>
<p class="mt-3 text-sm text-muted">
{{ $article->published_at?->format('Y-m-d') }} · {{ $article->author ?: '云创芯' }}
@if ($article->template === 'tech') <span class="ml-2 rounded bg-primary-soft px-2 py-0.5 text-xs font-medium text-primary">技术文档</span> @endif
@if ($article->template === 'feature') <span class="ml-2 rounded bg-primary-soft px-2 py-0.5 text-xs font-medium text-primary">专题报道</span> @endif
</p>
@if ($article->category)
<p class="mt-2 text-sm text-muted">分类:{{ $article->category->name }}</p>
@endif
@if ($article->template === 'feature' && $article->summary)
<p class="lead mt-5 text-base text-muted">{{ $article->summary }}</p>
@elseif ($article->summary)
<p class="mt-5 text-base text-muted">{{ $article->summary }}</p>
@endif
@if ($article->body)
<div class="prose mt-6 text-fg">
{{-- 旧文(纯文本)用 nl2br 换行,新文(Quill HTML)安全渲染(已过 Purifier --}}
@if (preg_match('/<[a-z][a-z0-9]*[\s>]/i', $article->body))
{!! $article->body !!}
@else
{!! nl2br(e($article->body)) !!}
@endif
</div>
@endif
</article>
<div class="mt-6">
<a href="{{ route('articles.index') }}" class="inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary-hover">
<x-icon name="arrow" :size="16" class="rotate-180" /> 返回文章列表
</a>
</div>
</div>
</section>
@endsection