aboutsummaryrefslogtreecommitdiff
path: root/themes/neonxp/layouts
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-11-16 19:32:18 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-11-17 01:28:57 +0300
commit239d68f94c6250276850fbe95eaa6cdd5c38fb26 (patch)
treec576da169afc442f51eae6213ad0ff749ed86589 /themes/neonxp/layouts
parent8e79098193fd0a8b65305dd8054cf7c424c60bc5 (diff)
Своя тема, полностью всё переделал
Diffstat (limited to 'themes/neonxp/layouts')
-rw-r--r--themes/neonxp/layouts/_default/baseof.html17
-rw-r--r--themes/neonxp/layouts/_default/home.html7
-rw-r--r--themes/neonxp/layouts/_default/list.html25
-rw-r--r--themes/neonxp/layouts/_default/single.html56
-rw-r--r--themes/neonxp/layouts/index.html30
-rw-r--r--themes/neonxp/layouts/partials/comments.html32
-rw-r--r--themes/neonxp/layouts/partials/footer.html19
-rw-r--r--themes/neonxp/layouts/partials/head.html6
-rw-r--r--themes/neonxp/layouts/partials/head/css.html27
-rw-r--r--themes/neonxp/layouts/partials/head/js.html12
-rw-r--r--themes/neonxp/layouts/partials/header.html8
-rw-r--r--themes/neonxp/layouts/partials/hmenu.html51
-rw-r--r--themes/neonxp/layouts/partials/list.html21
-rw-r--r--themes/neonxp/layouts/partials/menu.html51
-rw-r--r--themes/neonxp/layouts/partials/pagination.html98
-rw-r--r--themes/neonxp/layouts/partials/terms.html9
16 files changed, 469 insertions, 0 deletions
diff --git a/themes/neonxp/layouts/_default/baseof.html b/themes/neonxp/layouts/_default/baseof.html
new file mode 100644
index 0000000..e2e4362
--- /dev/null
+++ b/themes/neonxp/layouts/_default/baseof.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="{{ site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
+<head>
+ {{ partial "head.html" . }}
+</head>
+<body>
+ <main class="container">
+ <header>
+ {{ partial "header.html" . }}
+ </header>
+ {{ block "main" . }}{{ end }}
+ <footer>
+ {{ partial "footer.html" . }}
+ </footer>
+ </main>
+</body>
+</html>
diff --git a/themes/neonxp/layouts/_default/home.html b/themes/neonxp/layouts/_default/home.html
new file mode 100644
index 0000000..0df6597
--- /dev/null
+++ b/themes/neonxp/layouts/_default/home.html
@@ -0,0 +1,7 @@
+{{ define "main" }}
+ {{ .Content }}
+ {{ range site.RegularPages }}
+ <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
+ {{ .Summary }}
+ {{ end }}
+{{ end }}
diff --git a/themes/neonxp/layouts/_default/list.html b/themes/neonxp/layouts/_default/list.html
new file mode 100644
index 0000000..065ee1a
--- /dev/null
+++ b/themes/neonxp/layouts/_default/list.html
@@ -0,0 +1,25 @@
+{{ define "main" }}
+<div class="single-page">
+ <div class="sidebar">
+ <article class="toc">
+ <header>Навигатор</header>
+ {{ partial "menu.html" (dict "menuID" "sections" "page" .) }}
+ </article>
+ </div>
+ <div class="h-entry">
+ {{ if .Title }}
+ <article>
+ <header>{{ .Title }}</header>
+ {{ .Content }}
+ </article>
+ {{ end }}
+ <h1>Страницы:</h1>
+ {{ $paginator := .Paginate .Pages 7 }}
+ {{ range $paginator.Pages }}
+ {{ partial "list.html" . }}
+ {{ end }}
+ <nav>{{ partial "pagination.html" . }}</nav>
+ </div>
+</div>
+
+{{ end }}
diff --git a/themes/neonxp/layouts/_default/single.html b/themes/neonxp/layouts/_default/single.html
new file mode 100644
index 0000000..8a7b707
--- /dev/null
+++ b/themes/neonxp/layouts/_default/single.html
@@ -0,0 +1,56 @@
+{{ define "main" }}
+<div class="single-page">
+ <div class="sidebar">
+ <div class="toc">
+ {{ if .Params.toc }}
+ <article>
+ <header>Содержание</header>
+ <aside>{{ .TableOfContents }}</aside>
+ </article>
+ {{ end }}
+ <article>
+ <header>Разделы</header>
+ {{ partial "menu.html" (dict "menuID" "sections" "page" .) }}
+ </article>
+ </div>
+ </div>
+ <div class="h-entry">
+ <article>
+ <header class="space-between">
+ <span class="p-name">
+ {{ .Title }}
+ </span>
+ {{ if .Date }}
+ {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
+ {{ $dateHuman := .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") }}
+ <time class="dt-published" datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
+ {{ end }}
+ </header>
+ <div class="p-summary">
+ {{ .Summary }}
+ </div>
+ <div class="e-content">
+ {{ .Content }}
+ </div>
+ <footer class="space-between">
+ <span>
+ {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
+ </span>
+
+ <a class="u-url" href="{{ .Permalink }}">#</a>
+
+ {{ if .Params.Location }}
+ <span class="p-location">@ {{.Params.Location}}</span>
+ {{ end }}
+
+ {{ if .Lastmod }}
+ {{ $dateMachine := .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }}
+ {{ $dateHuman := .Lastmod | time.Format (or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006") }}
+ <time class="dt-updated" datetime="{{ $dateMachine }}">Изм: {{ $dateHuman }}</time>
+ {{ end }}
+ </footer>
+ </article>
+ {{ if .Params.comments }} {{ partial "comments.html" . }} {{ end }}
+ </div>
+</div>
+{{ end }}
diff --git a/themes/neonxp/layouts/index.html b/themes/neonxp/layouts/index.html
new file mode 100644
index 0000000..f92bc7f
--- /dev/null
+++ b/themes/neonxp/layouts/index.html
@@ -0,0 +1,30 @@
+{{ define "main" }}
+<div class="single-page">
+ <div class="sidebar">
+ <article class="toc">
+ <header>Навигатор</header>
+ {{ partial "menu.html" (dict "menuID" "sections" "page" .) }}
+ </article>
+ </div>
+ <div class="h-entry">
+ <article>
+ <header class="p-name">
+ {{ .Title }}
+ </header>
+ <div class="p-summary">
+ {{ .Summary }}
+ </div>
+ <div class="e-content">
+ {{ .Content }}
+ </div>
+ </article>
+ <h1>Блог</h1>
+ {{ $pages := where site.RegularPages "Type" "posts" }}
+ {{ $paginator := .Paginate $pages 7 }}
+ {{ range $paginator.Pages }}
+ {{ partial "list.html" . }}
+ {{ end }}
+ <nav>{{ partial "pagination.html" . }}</nav>
+ </div>
+</div>
+{{ end }}
diff --git a/themes/neonxp/layouts/partials/comments.html b/themes/neonxp/layouts/partials/comments.html
new file mode 100644
index 0000000..c01c3b7
--- /dev/null
+++ b/themes/neonxp/layouts/partials/comments.html
@@ -0,0 +1,32 @@
+{{- with .Site.Params.comments -}}
+<article>
+ <header>Комментарии</header>
+ <div id="remark42"></div>
+</article>
+<script>
+ var remark_config = {
+ host: '{{ .host }}',
+ site_id: '{{ .site }}',
+ components: ['embed'],
+ url: '{{ $.Permalink }}',
+ max_shown_comments: {{ default 15 .max_shown_comments }},
+ theme: (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches)?'dark':'light',
+ page_title: '{{ $.Title }}',
+ locale: '{{ default "en" .locale }}',
+ show_email_subscription: {{ default true .show_email_subscription }}
+ };
+
+ !function(e, n) {
+ for (var o = 0; o < e.length; o++) {
+ var r = n.createElement('script'),
+ c = '.js',
+ d = n.head || n.body;
+ 'noModule' in r ? (r.type = 'module', c = '.mjs') : r.async = !0, r.defer = !0, r.src = remark_config.host + '/web/' + e[o] + c, d.appendChild(r)
+ }
+ }(remark_config.components || ['embed'], document);
+
+ window.addEventListener('onColorSchemeChange', (e) => {
+ window.REMARK42.changeTheme(e.detail);
+ })
+</script>
+{{- end -}} \ No newline at end of file
diff --git a/themes/neonxp/layouts/partials/footer.html b/themes/neonxp/layouts/partials/footer.html
new file mode 100644
index 0000000..66e4774
--- /dev/null
+++ b/themes/neonxp/layouts/partials/footer.html
@@ -0,0 +1,19 @@
+<nav>
+ <ul>
+ <li>
+ <cite>2007—{{ now.Year }}</cite>
+ </li>
+ <li>
+ <cite> Александр NeonXP Кирюхин. </cite>
+ </li>
+ <li>
+ <cite>г.Казань</cite>
+ </li>
+ </ul>
+
+ <ul>
+ <li><a href="https://git.neonxp.ru/neonxp/blog">Исходный код</a>.</li>
+ <li><a href="mailto:i@neonxp.ru">Электропочта</a>.</li>
+ <li><a href="https://neonxp.ru/posts/index.xml">РСС</a>.</li>
+ </ul>
+</nav>
diff --git a/themes/neonxp/layouts/partials/head.html b/themes/neonxp/layouts/partials/head.html
new file mode 100644
index 0000000..2e7ffb0
--- /dev/null
+++ b/themes/neonxp/layouts/partials/head.html
@@ -0,0 +1,6 @@
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width">
+<link rel="icon" type="image/png" href="/favicon.png">
+<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
+{{ partialCached "head/css.html" . }}
+{{ partialCached "head/js.html" . }}
diff --git a/themes/neonxp/layouts/partials/head/css.html b/themes/neonxp/layouts/partials/head/css.html
new file mode 100644
index 0000000..09e7397
--- /dev/null
+++ b/themes/neonxp/layouts/partials/head/css.html
@@ -0,0 +1,27 @@
+{{- with resources.Get "css/pico.min.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 }}
+{{- with resources.Get "css/syntax.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 }}
+{{- 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/themes/neonxp/layouts/partials/head/js.html b/themes/neonxp/layouts/partials/head/js.html
new file mode 100644
index 0000000..18fe842
--- /dev/null
+++ b/themes/neonxp/layouts/partials/head/js.html
@@ -0,0 +1,12 @@
+{{- 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 }}
diff --git a/themes/neonxp/layouts/partials/header.html b/themes/neonxp/layouts/partials/header.html
new file mode 100644
index 0000000..c9b4934
--- /dev/null
+++ b/themes/neonxp/layouts/partials/header.html
@@ -0,0 +1,8 @@
+<nav>
+ <ul>
+ <li>
+ <a href="/"><img class="logo" src="{{ .Site.Params.Logo }}" /><strong>{{ .Site.Title }}</strong></a>
+ </li>
+ </ul>
+ {{ partial "hmenu.html" (dict "menuID" "main" "page" .) }}
+</nav>
diff --git a/themes/neonxp/layouts/partials/hmenu.html b/themes/neonxp/layouts/partials/hmenu.html
new file mode 100644
index 0000000..7183180
--- /dev/null
+++ b/themes/neonxp/layouts/partials/hmenu.html
@@ -0,0 +1,51 @@
+{{- /*
+Renders a menu for the given menu ID.
+
+@context {page} page The current page.
+@context {string} menuID The menu ID.
+
+@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }}
+*/}}
+
+{{- $page := .page }}
+{{- $menuID := .menuID }}
+
+{{- with index site.Menus $menuID }}
+ <nav>
+ <ul>
+ {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
+ </ul>
+ </nav>
+{{- end }}
+
+{{- define "partials/inline/menu/walk.html" }}
+ {{- $page := .page }}
+ {{- range .menuEntries }}
+ {{- $attrs := dict "href" .URL }}
+ {{- if $page.IsMenuCurrent .Menu . }}
+ {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
+ {{- else if $page.HasMenuCurrent .Menu .}}
+ {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
+ {{- end }}
+ {{- $name := .Name }}
+ {{- with .Identifier }}
+ {{- with T . }}
+ {{- $name = . }}
+ {{- end }}
+ {{- end }}
+ <li>
+ <a
+ {{- range $k, $v := $attrs }}
+ {{- with $v }}
+ {{- printf " %s=%q" $k $v | safeHTMLAttr }}
+ {{- end }}
+ {{- end -}}
+ >{{ $name }}</a>
+ {{- with .Children }}
+ <ul>
+ {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
+ </ul>
+ {{- end }}
+ </li>
+ {{- end }}
+{{- end }}
diff --git a/themes/neonxp/layouts/partials/list.html b/themes/neonxp/layouts/partials/list.html
new file mode 100644
index 0000000..3b1bacc
--- /dev/null
+++ b/themes/neonxp/layouts/partials/list.html
@@ -0,0 +1,21 @@
+<article>
+ <header class="space-between">
+ <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
+ {{ if .Date }}
+ <span>
+ {{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
+ </span>
+ {{ end }}
+ </header>
+ {{ if .Description }}
+ {{ .Description }}
+ {{ else }}
+ {{ .Summary }}
+ {{ if .Truncated }}
+ <a href="{{ .RelPermalink }}">Далее...</a>
+ {{ end }}
+ {{ end }}
+ <footer>
+ {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
+ </footer>
+</article> \ No newline at end of file
diff --git a/themes/neonxp/layouts/partials/menu.html b/themes/neonxp/layouts/partials/menu.html
new file mode 100644
index 0000000..97f2e1f
--- /dev/null
+++ b/themes/neonxp/layouts/partials/menu.html
@@ -0,0 +1,51 @@
+{{- /*
+Renders a menu for the given menu ID.
+
+@context {page} page The current page.
+@context {string} menuID The menu ID.
+
+@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }}
+*/}}
+
+{{- $page := .page }}
+{{- $menuID := .menuID }}
+
+{{- with index site.Menus $menuID }}
+ <aside>
+ <ul>
+ {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
+ </ul>
+ </aside>
+{{- end }}
+
+{{- define "partials/inline/menu/walk.html" }}
+ {{- $page := .page }}
+ {{- range .menuEntries }}
+ {{- $attrs := dict "href" .URL }}
+ {{- if $page.IsMenuCurrent .Menu . }}
+ {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
+ {{- else if $page.HasMenuCurrent .Menu .}}
+ {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
+ {{- end }}
+ {{- $name := .Name }}
+ {{- with .Identifier }}
+ {{- with T . }}
+ {{- $name = . }}
+ {{- end }}
+ {{- end }}
+ <li>
+ <a
+ {{- range $k, $v := $attrs }}
+ {{- with $v }}
+ {{- printf " %s=%q" $k $v | safeHTMLAttr }}
+ {{- end }}
+ {{- end -}}
+ >{{ $name }}</a>
+ {{- with .Children }}
+ <ul>
+ {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
+ </ul>
+ {{- end }}
+ </li>
+ {{- end }}
+{{- end }}
diff --git a/themes/neonxp/layouts/partials/pagination.html b/themes/neonxp/layouts/partials/pagination.html
new file mode 100644
index 0000000..ee7a171
--- /dev/null
+++ b/themes/neonxp/layouts/partials/pagination.html
@@ -0,0 +1,98 @@
+{{- $validFormats := slice "default" "terse" }}
+
+{{- $msg1 := "When passing a map to the internal pagination template, one of the elements must be named 'page', and it must be set to the context of the current page." }}
+{{- $msg2 := "The 'format' specified in the map passed to the internal pagination template is invalid. Valid choices are: %s." }}
+
+{{- $page := . }}
+{{- $format := "default" }}
+
+{{- if reflect.IsMap . }}
+ {{- with .page }}
+ {{- $page = . }}
+ {{- else }}
+ {{- errorf $msg1 }}
+ {{- end }}
+ {{- with .format }}
+ {{- $format = lower . }}
+ {{- end }}
+{{- end }}
+
+{{- if in $validFormats $format }}
+ {{- if gt $page.Paginator.TotalPages 1 }}
+ <ul class="pagination pagination-{{ $format }}">
+ {{- partial (printf "partials/inline/pagination/%s" $format) $page }}
+ </ul>
+ {{- end }}
+{{- else }}
+ {{- errorf $msg2 (delimit $validFormats ", ") }}
+{{- end -}}
+
+{{/* --------------------------------------------------------------------- */}}
+{{- define "partials/inline/pagination/default" }}
+ {{- with .Paginator }}
+ {{- $currentPageNumber := .PageNumber }}
+
+ {{- with .First }}
+ {{- if ne $currentPageNumber .PageNumber }}
+ <li class="page-item">
+ <a href="{{ .URL }}" aria-label="First" class="page-link"><span aria-hidden="true">&lAarr;</span></a>
+ </li>
+ {{- else }}
+ <li class="page-item disabled">
+ <a aria-disabled="true" aria-label="First" class="page-link" tabindex="-1"><span aria-hidden="true">&lAarr;</span></a>
+ </li>
+ {{- end }}
+ {{- end }}
+
+ {{- with .Prev }}
+ <li class="page-item">
+ <a href="{{ .URL }}" aria-label="Previous" class="page-link"><span aria-hidden="true">&larr;</span></a>
+ </li>
+ {{- else }}
+ <li class="page-item disabled">
+ <a aria-disabled="true" aria-label="Previous" class="page-link" tabindex="-1"><span aria-hidden="true">&larr;</span></a>
+ </li>
+ {{- end }}
+
+ {{- $slots := 5 }}
+ {{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }}
+ {{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }}
+ {{- if lt (add (sub $end $start) 1) $slots }}
+ {{- $start = math.Max 1 (add (sub $end $slots) 1) }}
+ {{- end }}
+
+ {{- range $k := seq $start $end }}
+ {{- if eq $.Paginator.PageNumber $k }}
+ <li class="page-item active">
+ [{{ $k }}]
+ </li>
+ {{- else }}
+ <li class="page-item">
+ <a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="page-link">{{ $k }}</a>
+ </li>
+ {{- end }}
+ {{- end }}
+
+ {{- with .Next }}
+ <li class="page-item">
+ <a href="{{ .URL }}" aria-label="Next" class="page-link"><span aria-hidden="true">&rarr;</span></a>
+ </li>
+ {{- else }}
+ <li class="page-item disabled">
+ <a aria-disabled="true" aria-label="Next" class="page-link" tabindex="-1"><span aria-hidden="true">&rarr;</span></a>
+ </li>
+ {{- end }}
+
+ {{- with .Last }}
+ {{- if ne $currentPageNumber .PageNumber }}
+ <li class="page-item">
+ <a href="{{ .URL }}" aria-label="Last" class="page-link"><span aria-hidden="true">&rAarr;</span></a>
+ </li>
+ {{- else }}
+ <li class="page-item disabled">
+ <a aria-disabled="true" aria-label="Last" class="page-link" tabindex="-1"><span aria-hidden="true">&rAarr;</span></a>
+ </li>
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- end -}} \ No newline at end of file
diff --git a/themes/neonxp/layouts/partials/terms.html b/themes/neonxp/layouts/partials/terms.html
new file mode 100644
index 0000000..9802a11
--- /dev/null
+++ b/themes/neonxp/layouts/partials/terms.html
@@ -0,0 +1,9 @@
+{{- $page := .page }}
+{{- $taxonomy := .taxonomy }}
+
+{{- with $page.GetTerms $taxonomy }}
+ {{- $label := (index . 0).Parent.LinkTitle }}
+ {{- range . }}
+ <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>&nbsp;
+ {{- end }}
+{{- end }}