Files
mce/templates/MetaLab-2026/html/posts/index.html
Victor_Jay a3f787ddaf feat: NAV 添加投稿入口,笔图标+投稿
- nav.html: 帖子后添加笔图标+投稿链接(仅登录可见),跳转 /studio/write
- posts/index.html: 移除独立的撰写帖子按钮
- common.css: 添加 .nav-contribute 样式,inline-flex + vertical-align: middle + line-height: 1
2026-05-31 15:53:30 +08:00

56 lines
1.7 KiB
HTML

{{template "layout/header.html" .}}
<body>
{{template "layout/nav.html" .}}
<div class="container posts-container">
<div class="posts-header">
<h1>社区帖子</h1>
</div>
{{if .Error}}
<div class="error-message">{{.Error}}</div>
{{end}}
{{if .Keyword}}
<div class="search-hint">搜索:<strong>{{.Keyword}}</strong></div>
{{end}}
<div class="posts-list">
{{if eq (len .Posts) 0}}
<div class="empty-state">暂无帖子</div>
{{else}}
{{range .Posts}}
<article class="post-card">
<h2 class="post-card-title">
<a href="/posts/{{.ID}}">{{.Title}}</a>
</h2>
<div class="post-card-meta">
<span class="post-author">{{if .AuthorName}}{{.AuthorName}}{{else}}该用户已注销{{end}}</span>
<span class="post-time">{{.CreatedAt.Format "2006-01-02 15:04"}}</span>
</div>
<p class="post-card-summary">{{if .Excerpt}}{{.Excerpt}}{{else}}{{printf "%.200s" .Body}}{{end}}</p>
</article>
{{end}}
{{end}}
</div>
{{if gt .TotalPages 1}}
<div class="pagination">
{{if gt .Page 1}}
<a href="?page={{.PrevPage}}{{if .Keyword}}&keyword={{.Keyword}}{{end}}" class="page-link">上一页</a>
{{end}}
<span class="page-info">第 {{.Page}} / {{.TotalPages}} 页 (共 {{.Total}} 条)</span>
{{if lt .Page .TotalPages}}
<a href="?page={{.NextPage}}{{if .Keyword}}&keyword={{.Keyword}}{{end}}" class="page-link">下一页</a>
{{end}}
</div>
{{end}}
</div>
{{template "layout/footer.html" .}}
<script src="/static/js/common.js?v={{assetV "/static/js/common.js"}}"></script>
</body>
</html>