- Add admin article list page at /admin/articles with status badges, pin marker, publish time, and edit/delete actions - Share the create/edit form: dynamic action URL, prefilled fields, is_top checkbox state, and create-vs-edit heading - Add ArticleUpdate/ArticleDelete handlers (soft-delete via DeletedAt); stamp PublishedAt on first publish - Add "Manage Articles" entry on the dashboard - Hide home page sign-in/dashboard buttons - Add EN/ZH i18n keys for the management UI Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
46 lines
2.1 KiB
HTML
46 lines
2.1 KiB
HTML
{{define "home"}}
|
|
{{template "header" .}}
|
|
<section class="max-w-5xl mx-auto px-4 py-20 text-center">
|
|
<h1 class="text-5xl font-extrabold text-gray-900 mb-4">
|
|
{{index .Tr "home_welcome"}}
|
|
</h1>
|
|
<p class="text-xl text-gray-600 mb-8 max-w-2xl mx-auto">
|
|
{{index .Tr "home_subtitle"}}
|
|
</p>
|
|
<!-- <div class="flex justify-center gap-4">
|
|
<a href="/login" class="inline-block bg-blue-600 text-white px-6 py-3 rounded-lg font-medium hover:bg-blue-700 transition-colors">
|
|
{{index .Tr "home_sign_in"}}
|
|
</a>
|
|
<a href="/admin" class="inline-block bg-gray-200 text-gray-700 px-6 py-3 rounded-lg font-medium hover:bg-gray-300 transition-colors">
|
|
{{index .Tr "home_to_dash"}}
|
|
</a>
|
|
</div> -->
|
|
</section>
|
|
|
|
<section class="max-w-5xl mx-auto px-4 py-16">
|
|
<h2 class="text-3xl font-bold text-gray-900 mb-8 text-center">{{index .Tr "home_latest"}}</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
{{range .Articles}}
|
|
<a href="/article/{{.Slug}}"
|
|
class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden hover:shadow-md transition-shadow flex flex-col">
|
|
{{if .Cover}}
|
|
<div class="aspect-video w-full overflow-hidden bg-gray-100">
|
|
<img src="{{.Cover}}" alt="{{.Title}}" class="w-full h-full object-cover">
|
|
</div>
|
|
{{end}}
|
|
<div class="p-6 flex flex-col flex-1">
|
|
<h3 class="text-lg font-semibold text-gray-800 mb-2">{{.Title}}
|
|
{{if .IsTop}}<span class="align-middle text-xs bg-blue-100 text-blue-700 px-2 py-0.5 rounded ml-1">{{index $.Tr "article_is_top"}}</span>{{end}}
|
|
</h3>
|
|
{{if .Summary}}<p class="text-gray-500 text-sm line-clamp-2">{{.Summary}}</p>{{end}}
|
|
<span class="mt-4 text-sm text-blue-600 font-medium">{{index $.Tr "home_read_more"}} →</span>
|
|
</div>
|
|
</a>
|
|
{{else}}
|
|
<div class="col-span-full text-center text-gray-500 py-12">{{index .Tr "home_no_posts"}}</div>
|
|
{{end}}
|
|
</div>
|
|
</section>
|
|
{{template "footer" .}}
|
|
{{end}}
|