qoder生成项目

This commit is contained in:
2026-02-13 10:53:54 +08:00
commit 4cab051f9c
24 changed files with 3627 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.Title}} - {{.SiteName}}</title>
<meta name="description" content="{{.Description}}">
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<header class="header">
<div class="container">
<h1 class="site-title">
<a href="/">{{.SiteName}}</a>
</h1>
<p class="site-desc">{{.SiteDesc}}</p>
<nav class="main-nav">
<a href="/">首页</a>
{{range .Pages}}
<a href="/page/{{.Slug}}">{{.Title}}</a>
{{end}}
</nav>
</div>
</header>
<main class="main container">
{{template "content" .}}
</main>
<footer class="footer">
<div class="container">
<p>&copy; {{.Year}} {{.SiteName}}. Powered by GoBlog.</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,51 @@
{{define "content"}}
<div class="post-list">
{{range .Posts}}
<article class="post-item">
{{if .Cover}}
<div class="post-cover">
<a href="/post/{{.Slug}}">
<img src="{{.Cover}}" alt="{{.Title}}">
</a>
</div>
{{end}}
<div class="post-content">
<h2 class="post-title">
<a href="/post/{{.Slug}}">{{.Title}}</a>
{{if .IsTop}}<span class="top-badge">置顶</span>{{end}}
</h2>
<div class="post-meta">
<span class="post-date">{{.PublishedAt.Format "2006-01-02"}}</span>
<span class="post-category">
<a href="/?category={{.CategoryID}}">{{.Category.Name}}</a>
</span>
{{if .Tags}}
<span class="post-tags">
{{range .Tags}}
<a href="/?tag={{.ID}}" class="tag">{{.Name}}</a>
{{end}}
</span>
{{end}}
<span class="post-views">{{.Views}} 阅读</span>
</div>
<p class="post-summary">{{.Summary}}</p>
<a href="/post/{{.Slug}}" class="read-more">阅读全文 →</a>
</div>
</article>
{{else}}
<div class="empty">暂无文章</div>
{{end}}
</div>
{{if gt .TotalPages 1}}
<div class="pagination">
{{if gt .CurrentPage 1}}
<a href="/?page={{sub .CurrentPage 1}}" class="prev">← 上一页</a>
{{end}}
<span class="page-info">{{.CurrentPage}} / {{.TotalPages}}</span>
{{if lt .CurrentPage .TotalPages}}
<a href="/?page={{add .CurrentPage 1}}" class="next">下一页 →</a>
{{end}}
</div>
{{end}}
{{end}}

View File

@@ -0,0 +1,11 @@
{{define "content"}}
<article class="page-detail">
<header class="page-header">
<h1 class="page-title">{{.Page.Title}}</h1>
</header>
<div class="page-body">
{{.Page.Content | html}}
</div>
</article>
{{end}}

View File

@@ -0,0 +1,87 @@
{{define "content"}}
<article class="post-detail">
<header class="post-header">
<h1 class="post-title">{{.Post.Title}}</h1>
<div class="post-meta">
<span class="post-date">{{.Post.PublishedAt.Format "2006-01-02 15:04"}}</span>
<span class="post-author">{{.Post.Author.Nickname}}</span>
<span class="post-category">
<a href="/?category={{.Post.CategoryID}}">{{.Post.Category.Name}}</a>
</span>
{{if .Post.Tags}}
<span class="post-tags">
{{range .Post.Tags}}
<a href="/?tag={{.ID}}" class="tag">{{.Name}}</a>
{{end}}
</span>
{{end}}
<span class="post-views">{{.Post.Views}} 阅读</span>
</div>
</header>
{{if .Post.Cover}}
<div class="post-cover">
<img src="{{.Post.Cover}}" alt="{{.Post.Title}}">
</div>
{{end}}
<div class="post-body">
{{.Post.Content | html}}
</div>
</article>
<section class="comments-section">
<h3>评论 ({{.CommentCount}})</h3>
<form class="comment-form" action="/comment" method="POST">
<input type="hidden" name="post_id" value="{{.Post.ID}}">
<div class="form-group">
<input type="text" name="author" placeholder="昵称" required>
</div>
<div class="form-group">
<input type="email" name="email" placeholder="邮箱" required>
</div>
<div class="form-group">
<input type="url" name="website" placeholder="网站(可选)">
</div>
<div class="form-group">
<textarea name="content" placeholder="写下你的评论..." required></textarea>
</div>
<button type="submit">发表评论</button>
</form>
<div class="comments-list">
{{range .Comments}}
<div class="comment-item" id="comment-{{.ID}}">
<div class="comment-header">
<span class="comment-author">
{{if .Website}}
<a href="{{.Website}}" target="_blank">{{.Author}}</a>
{{else}}
{{.Author}}
{{end}}
</span>
<span class="comment-date">{{.CreatedAt.Format "2006-01-02 15:04"}}</span>
</div>
<div class="comment-content">{{.Content}}</div>
{{if .Children}}
<div class="comment-children">
{{range .Children}}
<div class="comment-item child" id="comment-{{.ID}}">
<div class="comment-header">
<span class="comment-author">{{.Author}}</span>
<span class="comment-date">{{.CreatedAt.Format "2006-01-02 15:04"}}</span>
</div>
<div class="comment-content">{{.Content}}</div>
</div>
{{end}}
</div>
{{end}}
</div>
{{else}}
<p class="no-comments">暂无评论,来发表第一条评论吧!</p>
{{end}}
</div>
</section>
{{end}}