未完成版基础界面

This commit is contained in:
2025-11-23 22:11:31 +08:00
parent a469da2904
commit 3b5d4b193b
7 changed files with 46 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
{{ define "layout/base.html" }}
{{ define "base" }}
<!DOCTYPE html>
<html lang="zh">
<head>
@@ -7,7 +7,7 @@
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
{{ template "layout/navbar.html" . }}
{{ template "navbar" . }}
<main>
{{ block "content" . }}{{ end }}

View File

@@ -1,6 +1,6 @@
{{ define "layout/navbar.html" }}
{{ define "navbar" }}
<nav class="navbar">
<div class="logo">🔥 NanNanWu</div>
<div class="logo">🔥 MyGinSite</div>
<ul class="nav-links">
<li><a href="/">首页</a></li>
<li><a href="/about">关于我们</a></li>

View File

@@ -0,0 +1,9 @@
{{ define "about" }}
{{ template "base" . }}
{{ block "title" . }}关于我们{{ end }}
{{ block "content" . }}
<h2>关于我们</h2>
<p>这里可以写团队介绍、网站背景或使命。</p>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,13 @@
{{ define "articles" }}
{{ template "base" . }}
{{ block "title" . }}文章列表{{ end }}
{{ block "content" . }}
<h2>文章列表</h2>
<ul>
{{ range .Articles }}
<li>{{ .Title }} - {{ .Date }}</li>
{{ end }}
</ul>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,14 @@
{{ define "contact" }}
{{ template "base" . }}
{{ block "title" . }}联系我们{{ end }}
{{ block "content" . }}
<h2>联系我们</h2>
<form>
<label>姓名:</label><input type="text" name="name"><br>
<label>邮箱:</label><input type="email" name="email"><br>
<label>留言:</label><textarea name="message"></textarea><br>
<button type="submit">提交</button>
</form>
{{ end }}
{{ end }}

View File

@@ -1,5 +1,5 @@
{{ define "pages/index.html" }}
{{ template "layout/base.html" . }}
{{ define "index" }}
{{ template "base" . }}
{{ block "title" . }}首页{{ end }}
{{ block "content" . }}