Hugo内容

This commit is contained in:
2026-02-27 11:41:19 +08:00
parent 544c97c013
commit 4f7f72b65f
37 changed files with 795 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
{{ define "main" }}
{{- partial "back_link.html" . -}}
<header>
<h1>404 Not Found</h1>
</header>
{{ end }}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="{{ $.Site.LanguageCode }}">
{{- partial "head.html" . -}}
<body a="{{ $.Site.Params.theme_config.appearance | default "auto" }}">
<main class="page-content" aria-label="Content">
<div class="w">
{{- block "main" . }}{{- end }}
{{ partial "footer.html" }}
</div>
</main>
</body>
</html>

View File

@@ -0,0 +1,8 @@
{{ define "main" }}
{{ partial "back_link.html" .}}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ partial "post_list.html" (dict "context" . "section" .Section)}}
{{ end }}

View File

@@ -0,0 +1,21 @@
{{ define "main" }}
{{ partial "back_link.html" .}}
<article>
<p class="post-meta">
<time datetime="{{ .Date }}">
{{ .Date | time.Format site.Params.theme_config.date_format }}
</time>
</p>
<h1>{{ .Title }}</h1>
{{ if .Params.toc }}
<aside {{ if .Params.tocBorder }} class="toc" {{ end }}>
{{ .TableOfContents }}
</aside>
{{ end }}
{{ .Content }}
</article>
{{ end }}

View File

@@ -0,0 +1,8 @@
{{ define "main" }}
{{ partial "back_link.html" .}}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ partial "post_list.html" (dict "context" .)}}
{{ end }}

View File

@@ -0,0 +1,8 @@
{{ define "main" }}
{{ partial "back_link.html" .}}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ partial "post_list.html" (dict "context" .)}}
{{ end }}

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,12 @@
{{ define "main" }}
<header>
<h1>{{ $.Site.Title }}</h1>
{{- if $.Site.Params.theme_config.show_description -}}
<p>{{ $.Site.Params.description }}</p>
{{- end -}}
</header>
{{ .Content }}
{{ partial "menu_item.html" (dict "context" . "collection" $.Site.Data.menu.entries) }}
{{ end }}

View File

@@ -0,0 +1 @@
<a href="{{ "" | relURL }}">{{ $.Site.Params.theme_config.back_home_text }}</a>

View File

@@ -0,0 +1,11 @@
{{ if site.Params.theme_config.isShowFooter }}
{{ $footerContent := readFile "layouts/footer.md" }}
{{ if and $footerContent (ne $footerContent "") }}
{{ $footerContent | markdownify }}
{{ else }}
{{ warnf "layouts/footer.md file is not found or empty. Falling back to default footer." }}
<footer class="site-footer">
<p>&copy; {{ now.Format "2006" }} {{ site.Title }}</p>
</footer>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,22 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{{ if .IsPage }} <meta name="description" content="{{ .Summary }}"> {{ end }}
<title>
{{ if not .IsHome }}
{{ .Title }}
{{ else }}
{{ $.Site.Title }}
{{ end }}
</title>
<link rel="shortcut icon" type="image/x-icon" href="{{ $.Site.Params.favicon | relURL }}" />
{{ $options := (dict "outputStyle" "compressed" "enableSourceMap" (not hugo.IsProduction)) }}
{{ $sass := resources.Get "css/main.scss" }}
{{ $style := $sass | css.Sass $options | resources.Fingerprint "sha512" }}
<link rel="stylesheet" href="{{ $style.Permalink | relURL }}" integrity="{{ $style.Data.Integrity }}" />
{{ if .Params.mathjax }} {{ partial "mathjax.html" . }} {{ end }}
</head>

View File

@@ -0,0 +1,21 @@
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$','$$'], ['\\[', '\\]']],
processEscapes: true,
processEnvironments: true
},
options: {
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
};
window.addEventListener('load', (event) => {
document.querySelectorAll("mjx-container").forEach(function(x){
x.parentElement.classList += 'has-jax'})
});
</script>
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

View File

@@ -0,0 +1,19 @@
<ul>
{{- range $item := .collection -}}
<li>
{{- with $item.url -}}
<a href="{{ $item.url | relURL }}">{{ safeHTML $item.title }}</a>
{{- else -}}
{{ safeHTML $item.title }}
{{- end -}}
</li>
{{- if $item.entries }}
{{ partial "menu_item.html" (dict "context" . "collection" $item.entries) }}
{{- end -}}
{{- if $item.post_list -}}
{{ partial "post_list.html" (dict "context" . "section" $item.post_list.section "limit" $item.post_list.limit "show_more" $item.post_list.show_more "show_more_text" $item.post_list.show_more_text "show_more_url" $item.post_list.show_more_url) -}}
{{- end -}}
{{- end -}}
</ul>

View File

@@ -0,0 +1,39 @@
{{- $posts := "" -}}
{{- if .section -}}
{{- $posts = (where site.RegularPages "Section" .section) -}}
{{- else -}}
{{- if (eq .context.Kind "taxonomy") -}}
{{- $posts = .context.Pages -}}
{{- else -}}
{{- if (eq .context.Kind "term") -}}
{{- $posts = .context.Data.Pages -}}
{{- else -}}
{{- $posts = site.RegularPages }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $limit_exceeded:= "" -}}
{{- if (and .limit (gt (len $posts) .limit)) -}}
{{- $limit_exceeded = true -}}
{{- else -}}
{{- $limit_exceeded = false -}}
{{ end }}
{{- if (gt (len $posts) 0) }}
{{- if .limit }}
{{ $posts = (first .limit $posts ) }}
{{ end }}
<ul>
{{- range $post := $posts -}}
<li>
<span>{{- ($post.Date | time.Format site.Params.theme_config.date_format) }}</span>
<a href="{{ $post.Permalink | relURL }}">{{ $post.Title }}</a>
</li>
{{ end }}
{{- if and .show_more $limit_exceeded }}
<li><a href="{{ .show_more_url | relURL }}">{{ .show_more_text | default "Show more..." }}</a></li>
{{ end }}
</ul>
{{ end }}

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="{{ $.Site.LanguageCode }}">
{{- partial "head.html" . -}}
<body a="{{ $.Site.Params.theme_config.appearance | default "auto" }}">
<main class="page-content" aria-label="Content">
<div class="w">
<div class="post-meta">
{{ partial "back_link.html" .}}
<p>
<time datetime="{{ .Date }}">
{{ .Date | time.Format site.Params.theme_config.date_format }}
</time>
</p>
</div>
{{- block "main" . }}{{- end }}
</div>
</main>
</body>
{{- if .Params.custom_js -}}
{{- range .Params.custom_js -}}
{{ $js := resources.Get (print "js/" . ".js") }}
<script type="text/javascript" src="{{ $js.RelPermalink }}"></script>
{{- end -}}
{{- end -}}
</html>

View File

@@ -0,0 +1,21 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
<!-- divide post list by year -->
{{ if .Site.Params.theme_config.isListGroupByDate }}
{{ range .Pages.GroupByDate "2006 Year" }}
<p>{{ .Key }}</p>
<ul>
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ else }}
{{ partial "post_list.html" (dict "context" . "section" .Section)}}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,14 @@
{{ define "main" }}
<article>
<h1>{{ .Title }}</h1>
{{ if .Params.toc }}
<aside {{ if .Params.tocBorder }} class="toc" {{ end }}>
{{ .TableOfContents }}
</aside>
{{ end }}
{{ .Content }}
</article>
{{ end }}

View File

@@ -0,0 +1,6 @@
<details {{ if eq (.Get "open" | default "false") "true" }}open{{ end }}>
<summary>
{{ .Get "summary" | default "Details:" }}
</summary>
{{ .Inner | markdownify }}
</details>

View File

@@ -0,0 +1,3 @@
<span>
$${{ .Get 0 }}$$
</span>

View File

@@ -0,0 +1,3 @@
<span>
\({{ .Get 0 }}\)
</span>