init: hugo site with mytheme

This commit is contained in:
Ubuntu
2026-04-13 13:51:02 +08:00
commit e9b2dca47b
30 changed files with 287 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="zh-CN" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{{ "css/main.css" | relURL }}">
</head>
<body>
<header class="site-header">
<div class="header-inner">
<a href="/" class="site-title">{{ .Site.Title }}</a>
<nav class="site-nav">
<a href="/">首页</a>
<a href="/posts/">归档</a>
<a href="/categories/">分类</a>
<a href="/tags/">标签</a>
</nav>
</div>
</header>
<main class="main-content">{{ block "main" . }}{{ end }}</main>
<footer class="site-footer">
<div class="footer-inner">
<p>© {{ now.Year }} {{ .Site.Title }}</p>
{{ with .Site.Params.beian }}<p><a href="https://beian.miit.gov.cn" target="_blank">{{ . }}</a></p>{{ end }}
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,15 @@
{{ define "main" }}
<div class="home-hero">
<h1>{{ .Site.Title }}</h1>
<p class="hero-sub">{{ .Site.Params.subtitle }}</p>
</div>
<div class="post-list">
{{ range first 10 (where .Site.RegularPages "Type" "posts") }}
<div class="post-card">
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<div class="post-meta">{{ .Date.Format "2006-01-02" }}{{ with .Params.categories }} · {{ . }}{{ end }}</div>
<p class="post-summary">{{ with .Description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}</p>
</div>
{{ end }}
</div>
{{ end }}

View File

@@ -0,0 +1,13 @@
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{ define "main" }}
<div class="post-list">
<h1 class="list-title">{{ .Title }}</h1>
{{ range .Paginator.Pages }}
<div class="post-card">
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<div class="post-meta">{{ .Date.Format "2006-01-02" }}{{ with .Params.categories }} · {{ . }}{{ end }}</div>
<p class="post-summary">{{ with .Description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}</p>
</div>
{{ end }}
</div>
{{ end }}

View File

@@ -0,0 +1,8 @@
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{ define "main" }}
<article class="post-single">
<h1 class="post-title">{{ .Title }}</h1>
<div class="post-meta">{{ .Date.Format "2006-01-02" }}{{ with .Params.categories }} · {{ . }}{{ end }}</div>
<div class="post-content">{{ .Content }}</div>
</article>
{{ end }}

View File

@@ -0,0 +1,15 @@
{{ define "main" }}
<div class="home-hero">
<h1>{{ .Site.Title }}</h1>
<p class="hero-sub">{{ .Site.Params.subtitle }}</p>
</div>
<div class="post-list">
{{ range first 10 (where .Site.RegularPages "Type" "posts") }}
<div class="post-card">
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<div class="post-meta">{{ .Date.Format "2006-01-02" }}{{ with .Params.categories }} · {{ . }}{{ end }}</div>
<p class="post-summary">{{ with .Description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}</p>
</div>
{{ end }}
</div>
{{ end }}