基本样式测试
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>{{.title}}</h2>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>我是一个新闻界面</h2>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
17
templates/layout/base.html
Normal file
17
templates/layout/base.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{ define "layout/base.html" }}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ block "title" . }}默认标题{{ end }}</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
{{ template "layout/navbar.html" . }}
|
||||
|
||||
<main>
|
||||
{{ block "content" . }}{{ end }}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
||||
11
templates/layout/navbar.html
Normal file
11
templates/layout/navbar.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{ define "layout/navbar.html" }}
|
||||
<nav class="navbar">
|
||||
<div class="logo">🔥 NanNanWu</div>
|
||||
<ul class="nav-links">
|
||||
<li><a href="/">首页</a></li>
|
||||
<li><a href="/about">关于我们</a></li>
|
||||
<li><a href="/articles">文章</a></li>
|
||||
<li><a href="/contact">联系</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
{{ end }}
|
||||
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>{{.title}}</h2>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
9
templates/pages/index.html
Normal file
9
templates/pages/index.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{ define "pages/index.html" }}
|
||||
{{ template "layout/base.html" . }}
|
||||
|
||||
{{ block "title" . }}首页{{ end }}
|
||||
{{ block "content" . }}
|
||||
<h1>欢迎来到我的 Gin 网站</h1>
|
||||
<p>这里是首页内容,可以展示最新文章或公告。</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user