diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/baseof.html | 13 | ||||
| -rw-r--r-- | layouts/_default/home.html | 69 | ||||
| -rw-r--r-- | layouts/_default/list.html | 71 | ||||
| -rw-r--r-- | layouts/_default/single.html | 21 | ||||
| -rw-r--r-- | layouts/partials/footer.html | 5 | ||||
| -rw-r--r-- | layouts/partials/head.html | 1 | ||||
| -rw-r--r-- | layouts/partials/head/css.html | 1 | ||||
| -rw-r--r-- | layouts/partials/head/js.html | 1 | ||||
| -rw-r--r-- | layouts/partials/header.html | 1 | ||||
| -rw-r--r-- | layouts/partials/menu.html | 0 | ||||
| -rw-r--r-- | layouts/partials/pagination.html | 20 | ||||
| -rw-r--r-- | layouts/partials/terms.html | 11 |
12 files changed, 214 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..7091b0f --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,13 @@ +<!doctype html> +<html + lang="{{ site.Language.LanguageCode }}" + dir="{{ or site.Language.LanguageDirection `ltr` }}" +> + <head> + {{ partial "head.html" . }} + </head> + <body> + <main>{{ block "main" . }}{{ end }}</main> + </body> +</html> + diff --git a/layouts/_default/home.html b/layouts/_default/home.html new file mode 100644 index 0000000..ec365f8 --- /dev/null +++ b/layouts/_default/home.html @@ -0,0 +1,69 @@ +{{ define "main" }} + +<head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>{{site.Title}}</title> + <style> + .main { + text-align: center; + height: 200px; + position: absolute; + left: 50%; + top: 50%; + margin-left: -100px; + margin-top: -100px; + } + + .main h2 { + margin-bottom: 0.1px; + line-height: 0; + } + + hr::after { + content: "❧"; + color: #212721; + width: 10rem; + display: inline-block; + background: linear-gradient(to bottom, transparent calc(50% - 0.5px), #212721 calc(50% - 0.5px), #212721, #212721 calc(50% + 0.5px), transparent calc(50% + 0.5px)); + text-shadow: 0px 0px 3px #fff; + font-size: 1.5rem; + } + + hr { + padding: 0.3rem 0; + border: none; + width: 100%; + display: block; + text-align: center; + height: 1.5rem; + } + + ul { + margin-top: 3px; + text-align: left; + } + + li { + list-style: none; + } + + li a { + margin-right: 60px; + } + + </style> +</head> + +<body> + <div class="main"> + <h2>{{ .Site.Title }}</h2> + <hr> + <ul> + {{ range .Site.Params.homepage.content }} + <li><a href="{{ .url }}">- {{ .name }}</a></li> + {{ end }} + </ul> + </div> +</body> +{{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..f78fbf8 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,71 @@ +{{ define "main" }} + <header>{{ partial "header.html" . }}</header> + {{ .Content }} + + <!-- 创建分页器对象 --> + {{ $paginator := .Paginate .Pages }} + {{ range $paginator.Pages }} + <div class="post-title"> + <a class="rel-permalink" href="{{ .RelPermalink }}"> + <div class="post-date">{{ .PublishDate.Format "2006-01-02" }}</div> + {{ .LinkTitle }} + </a> + <br /> + </div> + {{ end }} + + <!-- 简洁分页导航 --> + {{ if gt $paginator.TotalPages 1 }} + <div class="pagination simplified-pagination"> + <nav aria-label="Page navigation"> + <ul> + <!-- 首页按钮 --> + <li> + {{ if $paginator.HasPrev }} + <a href="{{ $paginator.First.URL }}" aria-label="首页">««</a> + {{ else }} + <span aria-hidden="true" class="disabled">««</span> + {{ end }} + </li> + + <!-- 上一页按钮 --> + <li> + {{ if $paginator.HasPrev }} + <a href="{{ $paginator.Prev.URL }}" aria-label="上一页">«</a> + {{ else }} + <span aria-hidden="true" class="disabled">«</span> + {{ end }} + </li> + + <!-- 当前页/总页数 --> + <li class="current-page"> + <span>{{ $paginator.PageNumber }}/{{ $paginator.TotalPages }}</span> + </li> + + <!-- 下一页按钮 --> + <li> + {{ if $paginator.HasNext }} + <a href="{{ $paginator.Next.URL }}" aria-label="下一页">»</a> + {{ else }} + <span aria-hidden="true" class="disabled">»</span> + {{ end }} + </li> + + <!-- 末页按钮 --> + <li> + {{ if $paginator.HasNext }} + <a href="{{ $paginator.Last.URL }}" aria-label="末页">»»</a> + {{ else }} + <span aria-hidden="true" class="disabled">»»</span> + {{ end }} + </li> + </ul> + </nav> + </div> + {{ end }} + <footer> + {{ partial "footer.html" . }} + </footer> + + +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..7ce6180 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,21 @@ +{{ define "main" }} + <header>{{ partial "header.html" . }}</header> + <h2>{{ .Title }}</h2> +<time datetime="{{ .Date | time.Format "2006-01-02" }}"> + {{ .Date | time.Format "2006-01-02" }} + </time> + +<div class="post-content"> +{{ .Content | safeHTML}} +</div> + {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} <div id="waline"></div> +<link rel="stylesheet" href="/css/main.css" /> +<div id="waline"></div> +<script + type="module"> import { init } from 'https://unpkg.com/@waline/client@v3/dist/waline.js'; init({ el: '#waline', serverURL: 'waline.yingyu5658.me', }); </script> + <footer> + {{ partial "footer.html" . }} + </footer> + + +{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..7fcbd79 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,5 @@ +<p>-----------------------------------</p> +{{ range .Site.Params.footer }} +<p>{{ . }}</p> +{{ end }} +<img src="/notbyai.png" class="not-by-ai" /> <br> diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..c7d08d3 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1 @@ +<meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title> {{ partialCached "head/css.html" . }} {{ partialCached "head/js.html" . }}
\ No newline at end of file diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html new file mode 100644 index 0000000..b260134 --- /dev/null +++ b/layouts/partials/head/css.html @@ -0,0 +1 @@ +{{- with resources.Get "css/main.css" }} {{- if eq hugo.Environment "development" }} <link rel="stylesheet" href="{{ .RelPermalink }}"> {{- else }} {{- with . | minify | fingerprint }} <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> {{- end }} {{- end }} {{- end }}
\ No newline at end of file diff --git a/layouts/partials/head/js.html b/layouts/partials/head/js.html new file mode 100644 index 0000000..7a0d28d --- /dev/null +++ b/layouts/partials/head/js.html @@ -0,0 +1 @@ +{{- with resources.Get "js/main.js" }} {{- if eq hugo.Environment "development" }} {{- with . | js.Build }} <script src="{{ .RelPermalink }}"></script> {{- end }} {{- else }} {{- $opts := dict "minify" true }} {{- with . | js.Build $opts | fingerprint }} <script src="{{ .RelPermalink }}" integrity="{{- .Data.Integrity }}" crossorigin="anonymous"></script> {{- end }} {{- end }} {{- end }}
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..696928e --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1 @@ +<h1 class="title">{{ site.Title }}</h1> <p class="subtitle">yingyu5658的数字花园</p> {{ partial "menu.html" (dict "menuID" "main" "page" .) }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/menu.html diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..a59e79e --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,20 @@ +{{ with .Paginator }} + {{ if gt .TotalPages 1 }} + <div class="custom-pagination"> + {{ if .HasPrev }} + <a href="{{ .Prev.URL }}">««</a> + <a href="{{ .Prev.URL }}">«</a> + {{ end }} + + {{ range .Pagers }} + <a class="{{ if eq .PageNumber $.PageNumber }}active{{ end }}" + href="{{ .URL }}">{{ .PageNumber }}</a> + {{ end }} + + {{ if .HasNext }} + <a href="{{ .Next.URL }}">»</a> + <a href="{{ .Next.URL }}">»»</a> + {{ end }} + </div> + {{ end }} +{{ end }} diff --git a/layouts/partials/terms.html b/layouts/partials/terms.html new file mode 100644 index 0000000..02bf412 --- /dev/null +++ b/layouts/partials/terms.html @@ -0,0 +1,11 @@ +{{- /* For a given taxonomy, renders a list of terms assigned to the page. +@context {page} page The current page. @context {string} taxonomy The taxonomy. +@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} */}} {{- +$page := .page }} {{- $taxonomy := .taxonomy }} {{- with $page.GetTerms +$taxonomy }} {{- $label := (index . 0).Parent.LinkTitle }} +<div> + {{- range . }} + <a class="label" href="{{ .RelPermalink }}">#{{ .LinkTitle }}</a> + {{- end }} +</div> +{{- end }} |
