未完成版基础界面
This commit is contained in:
@@ -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 }}
|
||||
|
||||
@@ -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>
|
||||
|
||||
9
templates/pages/about.html
Normal file
9
templates/pages/about.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{ define "about" }}
|
||||
{{ template "base" . }}
|
||||
|
||||
{{ block "title" . }}关于我们{{ end }}
|
||||
{{ block "content" . }}
|
||||
<h2>关于我们</h2>
|
||||
<p>这里可以写团队介绍、网站背景或使命。</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
13
templates/pages/articles.html
Normal file
13
templates/pages/articles.html
Normal 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 }}
|
||||
14
templates/pages/contact.html
Normal file
14
templates/pages/contact.html
Normal 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 }}
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ define "pages/index.html" }}
|
||||
{{ template "layout/base.html" . }}
|
||||
{{ define "index" }}
|
||||
{{ template "base" . }}
|
||||
|
||||
{{ block "title" . }}首页{{ end }}
|
||||
{{ block "content" . }}
|
||||
|
||||
Reference in New Issue
Block a user