From 75c97e730a5931426848997f6163c6555cd50ae2 Mon Sep 17 00:00:00 2001 From: 7ma7X Date: Mon, 1 Jun 2020 17:39:47 +0900 Subject: initial commit --- layouts/_default/baseof.html | 11 +++++++++++ layouts/_default/list.html | 29 +++++++++++++++++++++++++++++ layouts/_default/single.html | 25 +++++++++++++++++++++++++ layouts/_default/terms.html | 16 ++++++++++++++++ layouts/partials/footer.html | 12 ++++++++++++ layouts/partials/head.html | 14 ++++++++++++++ layouts/partials/header.html | 42 ++++++++++++++++++++++++++++++++++++++++++ layouts/partials/nav.html | 22 ++++++++++++++++++++++ layouts/partials/postmeta.html | 9 +++++++++ layouts/partials/preview.html | 14 ++++++++++++++ layouts/partials/toc.html | 18 ++++++++++++++++++ 11 files changed, 212 insertions(+) create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/single.html create mode 100644 layouts/_default/terms.html create mode 100644 layouts/partials/footer.html create mode 100644 layouts/partials/head.html create mode 100644 layouts/partials/header.html create mode 100644 layouts/partials/nav.html create mode 100644 layouts/partials/postmeta.html create mode 100644 layouts/partials/preview.html create mode 100644 layouts/partials/toc.html (limited to 'layouts') diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..abd1ee2 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,11 @@ + + + {{- partial "head.html" . -}} + + {{- partial "header.html" . -}} +
+ {{- block "main" . }}{{- end }} +
+ {{- partial "footer.html" . -}} + + diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..97ac744 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,29 @@ +{{ define "main" }} +
+
+ {{ if .IsHome }} + {{ $pag := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }} + {{ else }} + {{ $pag := .Paginator.Pages }} + {{ end }} + + {{ range .Paginator.Pages }} + {{ partial "preview.html" . }} + {{ end }} +
+ {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} + + {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..9997b19 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,25 @@ +{{ define "main" }} +
+
+ +
+ {{ partial "toc.html" . }} + + {{ if .Params.tags }} +
+ {{ range .Params.tags }} + {{ . }}  + {{ end }} +
+ {{ end }} +
+ {{ if and (gt .WordCount 400) (.Param "backtotop") }} + {{ partial "backtotop.html" . }} + + {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..86b9e27 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,16 @@ +{{ define "main" }} + +
+
+ {{ range .Data.Terms.Alphabetical }} +
+

+ {{ .Page.Title }} + {{ .Count }} +

+
+ {{ end }} +
+
+ +{{ end }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..5ccbfa1 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..b67c244 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,14 @@ + +{{ .Title }} +{{ with .Site.Params.description }} + +{{ end }} +{{- with .Site.Author.Name }} + +{{- end }} + + + + + +{{ hugo.Generator -}} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..61ed785 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,42 @@ + +{{ if .IsHome }} +{{ if .Site.Params.homeTitle }} + {{ $.Scratch.Set "title" .Site.Params.homeTitle }} +{{ else }} + {{ $.Scratch.Set "title" .Site.Title }} +{{ end }} +{{ else }} +{{ $.Scratch.Set "title" .Title }} +{{ end }} + +{{ $title := $.Scratch.Get "title" }} +{{ if $title }} +
+ {{ partial "nav.html" . }} +
+
+
+ {{ if eq .Type "list" }} +

{{ if .Data.Singular }}#{{ end }}{{ .Title }}

+ {{ else }} +

{{ with $title }}{{.}}{{ else }}
{{ end }}

+ {{ if .IsHome }} +

{{ with .Site.Author.name }}{{.}}{{ else }}
{{ end }}

+ + {{ if .Site.Author.abstract }} +
+
Abstract
+

+ {{ .Site.Author.abstract }} +

+
+ {{ end }} + {{ end }} + {{ end }} +
+
+
+
+{{ else }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html new file mode 100644 index 0000000..7a88907 --- /dev/null +++ b/layouts/partials/nav.html @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/layouts/partials/postmeta.html b/layouts/partials/postmeta.html new file mode 100644 index 0000000..bdf53cc --- /dev/null +++ b/layouts/partials/postmeta.html @@ -0,0 +1,9 @@ + + {{ .Lastmod.Format ( .Site.Params.dateformat | default "Jan 2, 2006") }} + {{ if .Params.categories }} +
+ {{ range .Params.categories }} + {{ . }}  + {{ end }} + {{ end }} +
\ No newline at end of file diff --git a/layouts/partials/preview.html b/layouts/partials/preview.html new file mode 100644 index 0000000..65a80ac --- /dev/null +++ b/layouts/partials/preview.html @@ -0,0 +1,14 @@ +
+ +

{{ .Title }}

+
+ +
+ {{ if .Truncated }} +

{{ .Summary }}

+ Read More + {{ end }} +
+
\ No newline at end of file diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html new file mode 100644 index 0000000..8d459e3 --- /dev/null +++ b/layouts/partials/toc.html @@ -0,0 +1,18 @@ +{{ if and (gt .WordCount 400) (.Param "toc") }} + {{- /* 正規表現でh[1-6]を探す */ -}} + {{- $header := (findRE "(?:.|\n)*?" .Content) -}} + {{- /* 最初に出現するh[1-6]を取得 */ -}} + {{- $firstH := index $header 0 -}} + + {{- if ne $firstH nil -}} + {{- /* ヘッダーの前にToCを結合した「新しいヘッダー」を作成 */ -}} + {{- $newH := printf `%s%s` .TableOfContents $firstH -}} + {{- /* 古いヘッダーを新しいヘッダーに置換して出力 */ -}} + {{- replace .Content $firstH $newH | safeHTML -}} + {{- else -}} + {{- /* そもそもヘッダーがない時は普通に出力 */ -}} + {{- .Content -}} + {{- end -}} +{{ else }} + {{ .Content }} +{{ end }} \ No newline at end of file -- cgit v1.2.3