From 239d68f94c6250276850fbe95eaa6cdd5c38fb26 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Sat, 16 Nov 2024 19:32:18 +0300 Subject: Своя тема, полностью всё переделал MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/neonxp/layouts/_default/baseof.html | 17 +++++ themes/neonxp/layouts/_default/home.html | 7 ++ themes/neonxp/layouts/_default/list.html | 25 +++++++ themes/neonxp/layouts/_default/single.html | 56 +++++++++++++++ themes/neonxp/layouts/index.html | 30 ++++++++ themes/neonxp/layouts/partials/comments.html | 32 +++++++++ themes/neonxp/layouts/partials/footer.html | 19 +++++ themes/neonxp/layouts/partials/head.html | 6 ++ themes/neonxp/layouts/partials/head/css.html | 27 +++++++ themes/neonxp/layouts/partials/head/js.html | 12 ++++ themes/neonxp/layouts/partials/header.html | 8 +++ themes/neonxp/layouts/partials/hmenu.html | 51 ++++++++++++++ themes/neonxp/layouts/partials/list.html | 21 ++++++ themes/neonxp/layouts/partials/menu.html | 51 ++++++++++++++ themes/neonxp/layouts/partials/pagination.html | 98 ++++++++++++++++++++++++++ themes/neonxp/layouts/partials/terms.html | 9 +++ 16 files changed, 469 insertions(+) create mode 100644 themes/neonxp/layouts/_default/baseof.html create mode 100644 themes/neonxp/layouts/_default/home.html create mode 100644 themes/neonxp/layouts/_default/list.html create mode 100644 themes/neonxp/layouts/_default/single.html create mode 100644 themes/neonxp/layouts/index.html create mode 100644 themes/neonxp/layouts/partials/comments.html create mode 100644 themes/neonxp/layouts/partials/footer.html create mode 100644 themes/neonxp/layouts/partials/head.html create mode 100644 themes/neonxp/layouts/partials/head/css.html create mode 100644 themes/neonxp/layouts/partials/head/js.html create mode 100644 themes/neonxp/layouts/partials/header.html create mode 100644 themes/neonxp/layouts/partials/hmenu.html create mode 100644 themes/neonxp/layouts/partials/list.html create mode 100644 themes/neonxp/layouts/partials/menu.html create mode 100644 themes/neonxp/layouts/partials/pagination.html create mode 100644 themes/neonxp/layouts/partials/terms.html (limited to 'themes/neonxp/layouts') 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 @@ + + + + {{ partial "head.html" . }} + + +
+
+ {{ partial "header.html" . }} +
+ {{ block "main" . }}{{ end }} +
+ {{ partial "footer.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 }} +

{{ .LinkTitle }}

+ {{ .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" }} +
+ +
+ {{ if .Title }} +
+
{{ .Title }}
+ {{ .Content }} +
+ {{ end }} +

Страницы:

+ {{ $paginator := .Paginate .Pages 7 }} + {{ range $paginator.Pages }} + {{ partial "list.html" . }} + {{ end }} + +
+
+ +{{ 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" }} +
+ +
+
+
+ + {{ .Title }} + + {{ 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") }} + + {{ end }} +
+
+ {{ .Summary }} +
+
+ {{ .Content }} +
+
+ + {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} + + + # + + {{ if .Params.Location }} + @ {{.Params.Location}} + {{ 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") }} + + {{ end }} +
+
+ {{ if .Params.comments }} {{ partial "comments.html" . }} {{ end }} +
+
+{{ 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" }} +
+ +
+
+
+ {{ .Title }} +
+
+ {{ .Summary }} +
+
+ {{ .Content }} +
+
+

Блог

+ {{ $pages := where site.RegularPages "Type" "posts" }} + {{ $paginator := .Paginate $pages 7 }} + {{ range $paginator.Pages }} + {{ partial "list.html" . }} + {{ end }} + +
+
+{{ 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 -}} +
+
Комментарии
+
+
+ +{{- 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 @@ + 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 @@ + + + +{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }} +{{ 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" }} + + {{- else }} + {{- with . | minify | fingerprint }} + + {{- end }} + {{- end }} +{{- end }} +{{- with resources.Get "css/syntax.css" }} + {{- if eq hugo.Environment "development" }} + + {{- else }} + {{- with . | minify | fingerprint }} + + {{- end }} + {{- end }} +{{- end }} +{{- with resources.Get "css/main.css" }} + {{- if eq hugo.Environment "development" }} + + {{- else }} + {{- with . | minify | fingerprint }} + + {{- 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 }} + + {{- end }} + {{- else }} + {{- $opts := dict "minify" true }} + {{- with . | js.Build $opts | fingerprint }} + + {{- 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 @@ + 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 }} + +{{- 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 }} +
  • + {{ $name }} + {{- with .Children }} + + {{- end }} +
  • + {{- 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 @@ +
    +
    + {{ .LinkTitle }} + {{ if .Date }} + + {{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}} + + {{ end }} +
    + {{ if .Description }} + {{ .Description }} + {{ else }} + {{ .Summary }} + {{ if .Truncated }} + Далее... + {{ end }} + {{ end }} +
    + {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} +
    +
    \ 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 }} + +{{- 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 }} +
  • + {{ $name }} + {{- with .Children }} + + {{- end }} +
  • + {{- 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 }} + + {{- end }} +{{- else }} + {{- errorf $msg2 (delimit $validFormats ", ") }} +{{- end -}} + +{{/* --------------------------------------------------------------------- */}} +{{- define "partials/inline/pagination/default" }} + {{- with .Paginator }} + {{- $currentPageNumber := .PageNumber }} + + {{- with .First }} + {{- if ne $currentPageNumber .PageNumber }} +
  • + +
  • + {{- else }} +
  • + +
  • + {{- end }} + {{- end }} + + {{- with .Prev }} +
  • + +
  • + {{- else }} +
  • + +
  • + {{- 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 }} +
  • + [{{ $k }}] +
  • + {{- else }} +
  • + {{ $k }} +
  • + {{- end }} + {{- end }} + + {{- with .Next }} +
  • + +
  • + {{- else }} +
  • + +
  • + {{- end }} + + {{- with .Last }} + {{- if ne $currentPageNumber .PageNumber }} +
  • + +
  • + {{- else }} +
  • + +
  • + {{- 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 . }} + {{ .LinkTitle }}  + {{- end }} +{{- end }} -- cgit v1.2.3