init: hugo site with mytheme
This commit is contained in:
60
themes/mytheme/assets/css/main.css
Normal file
60
themes/mytheme/assets/css/main.css
Normal file
@@ -0,0 +1,60 @@
|
||||
/** 茶凉小记 - 赛博深色风格 */
|
||||
:root {
|
||||
--bg: #0a0a0f;
|
||||
--surface: #12121a;
|
||||
--border: #1e1e2e;
|
||||
--text: #e0e0e0;
|
||||
--text-muted: #888;
|
||||
--accent: #00d4ff;
|
||||
--accent-dim: #00d4ff33;
|
||||
--code-bg: #16161f;
|
||||
--font: 'JetBrains Mono', monospace;
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
html { scroll-behavior: smooth; }
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: var(--font);
|
||||
font-size: 15px;
|
||||
line-height: 1.7;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
|
||||
.site-header { padding: 2rem 0 1.5rem; border-bottom: 1px solid var(--border); }
|
||||
.header-inner { max-width: 800px; margin: 0 auto; padding: 0 2rem; display: flex; justify-content: space-between; align-items: center; }
|
||||
.site-title { font-size: 1.2rem; font-weight: 700; color: var(--accent) !important; letter-spacing: 0.05em; }
|
||||
.site-nav a { color: var(--text-muted); margin-left: 2rem; font-size: 0.85rem; }
|
||||
.site-nav a:hover { color: var(--accent); text-decoration: none; }
|
||||
|
||||
.main-content { flex: 1; max-width: 800px; margin: 0 auto; padding: 4rem 2rem; width: 100%; }
|
||||
.home-hero { text-align: center; padding: 4rem 0 3rem; }
|
||||
.home-hero h1 { font-size: 2.5rem; font-weight: 700; color: var(--accent); margin-bottom: 0.5rem; }
|
||||
.hero-sub { color: var(--text-muted); font-size: 0.9rem; }
|
||||
.post-list { margin-top: 2rem; }
|
||||
.post-card { padding: 1.5rem 0; border-bottom: 1px solid var(--border); }
|
||||
.post-card h2 { font-size: 1.1rem; margin-bottom: 0.3rem; }
|
||||
.post-card h2 a { color: var(--text); }
|
||||
.post-card h2 a:hover { color: var(--accent); text-decoration: none; }
|
||||
.post-meta { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.5rem; }
|
||||
.post-summary { color: var(--text-muted); font-size: 0.85rem; line-height: 1.6; }
|
||||
.post-single { max-width: 680px; margin: 0 auto; }
|
||||
.post-title { font-size: 1.8rem; color: var(--text); margin-bottom: 0.5rem; }
|
||||
.post-single .post-meta { margin-bottom: 2rem; }
|
||||
.post-content { line-height: 1.8; }
|
||||
.post-content h2, .post-content h3 { color: var(--text); margin: 2rem 0 1rem; }
|
||||
.post-content p { margin-bottom: 1.2rem; }
|
||||
.post-content code { background: var(--code-bg); padding: 0.15em 0.4em; border-radius: 3px; font-size: 0.88em; color: var(--accent); }
|
||||
.post-content pre { background: var(--code-bg); padding: 1.2rem; border-radius: 6px; overflow-x: auto; margin-bottom: 1.2rem; }
|
||||
.post-content pre code { background: none; padding: 0; color: var(--text); }
|
||||
.post-content blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text-muted); margin: 1.5rem 0; }
|
||||
.post-content img { max-width: 100%; border-radius: 6px; margin: 1.5rem 0; }
|
||||
.site-footer { border-top: 1px solid var(--border); padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.8rem; }
|
||||
.footer-inner p { margin: 0.3rem 0; }
|
||||
.footer-inner a { color: var(--text-muted); }
|
||||
.footer-inner a:hover { color: var(--accent); }
|
||||
@media (max-width: 600px) { .header-inner { flex-direction: column; gap: 1rem; } .site-nav a { margin: 0 0.8rem; } .home-hero h1 { font-size: 1.8rem; } .post-title { font-size: 1.4rem; } }
|
||||
31
themes/mytheme/layouts/_default/baseof.html
Normal file
31
themes/mytheme/layouts/_default/baseof.html
Normal 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>
|
||||
15
themes/mytheme/layouts/_default/index.html
Normal file
15
themes/mytheme/layouts/_default/index.html
Normal 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 }}
|
||||
13
themes/mytheme/layouts/_default/list.html
Normal file
13
themes/mytheme/layouts/_default/list.html
Normal 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 }}
|
||||
8
themes/mytheme/layouts/_default/single.html
Normal file
8
themes/mytheme/layouts/_default/single.html
Normal 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 }}
|
||||
15
themes/mytheme/layouts/index.html
Normal file
15
themes/mytheme/layouts/index.html
Normal 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 }}
|
||||
3
themes/mytheme/theme.toml
Normal file
3
themes/mytheme/theme.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
name = "mytheme"
|
||||
license = "MIT"
|
||||
min_version = "0.123.0"
|
||||
Reference in New Issue
Block a user