From 900bb5e845c3ad44defbd427cae3d44a4a43321f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 25 Feb 2023 13:15:44 +0100 Subject: feat: Initial commit --- .../layouts/partials/content/card-image.html | 17 ++ .../frontpage/layouts/partials/content/figure.html | 37 +++ code/frontpage/layouts/partials/content/image.html | 32 +++ code/frontpage/layouts/partials/footer/footer.html | 18 ++ .../layouts/partials/footer/script-footer.html | 119 ++++++++++ .../layouts/partials/head/custom-head.html | 1 + code/frontpage/layouts/partials/head/favicons.html | 9 + code/frontpage/layouts/partials/head/head.html | 11 + .../frontpage/layouts/partials/head/opengraph.html | 69 ++++++ .../layouts/partials/head/resource-hints.html | 4 + .../layouts/partials/head/script-header.html | 8 + code/frontpage/layouts/partials/head/seo.html | 48 ++++ .../layouts/partials/head/structured-data.html | 210 +++++++++++++++++ .../layouts/partials/head/stylesheet.html | 11 + .../layouts/partials/head/twitter_cards.html | 24 ++ code/frontpage/layouts/partials/header/alert.html | 10 + code/frontpage/layouts/partials/header/header.html | 254 +++++++++++++++++++++ .../frontpage/layouts/partials/main/blog-meta.html | 2 + .../layouts/partials/main/breadcrumb.html | 4 + code/frontpage/layouts/partials/main/date.html | 6 + .../layouts/partials/main/docs-navigation.html | 24 ++ .../frontpage/layouts/partials/main/edit-page.html | 34 +++ .../layouts/partials/main/last-modified.html | 10 + .../partials/sidebar/auto-collapsible-menu.html | 57 +++++ .../partials/sidebar/auto-default-menu.html | 37 +++ .../layouts/partials/sidebar/docs-menu.html | 9 + .../layouts/partials/sidebar/docs-toc.html | 26 +++ .../partials/sidebar/manual-collapsible-menu.html | 63 +++++ .../partials/sidebar/manual-default-menu.html | 41 ++++ 29 files changed, 1195 insertions(+) create mode 100644 code/frontpage/layouts/partials/content/card-image.html create mode 100644 code/frontpage/layouts/partials/content/figure.html create mode 100644 code/frontpage/layouts/partials/content/image.html create mode 100644 code/frontpage/layouts/partials/footer/footer.html create mode 100644 code/frontpage/layouts/partials/footer/script-footer.html create mode 100644 code/frontpage/layouts/partials/head/custom-head.html create mode 100644 code/frontpage/layouts/partials/head/favicons.html create mode 100644 code/frontpage/layouts/partials/head/head.html create mode 100644 code/frontpage/layouts/partials/head/opengraph.html create mode 100644 code/frontpage/layouts/partials/head/resource-hints.html create mode 100644 code/frontpage/layouts/partials/head/script-header.html create mode 100644 code/frontpage/layouts/partials/head/seo.html create mode 100644 code/frontpage/layouts/partials/head/structured-data.html create mode 100644 code/frontpage/layouts/partials/head/stylesheet.html create mode 100644 code/frontpage/layouts/partials/head/twitter_cards.html create mode 100644 code/frontpage/layouts/partials/header/alert.html create mode 100644 code/frontpage/layouts/partials/header/header.html create mode 100644 code/frontpage/layouts/partials/main/blog-meta.html create mode 100644 code/frontpage/layouts/partials/main/breadcrumb.html create mode 100644 code/frontpage/layouts/partials/main/date.html create mode 100644 code/frontpage/layouts/partials/main/docs-navigation.html create mode 100644 code/frontpage/layouts/partials/main/edit-page.html create mode 100644 code/frontpage/layouts/partials/main/last-modified.html create mode 100644 code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html create mode 100644 code/frontpage/layouts/partials/sidebar/auto-default-menu.html create mode 100644 code/frontpage/layouts/partials/sidebar/docs-menu.html create mode 100644 code/frontpage/layouts/partials/sidebar/docs-toc.html create mode 100644 code/frontpage/layouts/partials/sidebar/manual-collapsible-menu.html create mode 100644 code/frontpage/layouts/partials/sidebar/manual-default-menu.html (limited to 'code/frontpage/layouts/partials') diff --git a/code/frontpage/layouts/partials/content/card-image.html b/code/frontpage/layouts/partials/content/card-image.html new file mode 100644 index 0000000..51a5e51 --- /dev/null +++ b/code/frontpage/layouts/partials/content/card-image.html @@ -0,0 +1,17 @@ +{{ $fillImage := .Scratch.Get "fillImageCard" }} +{{ if not $fillImage -}} +{{ $fillImage = site.Params.fillImage }} +{{ end -}} + +{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }} +{{ if not $image -}} +{{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }} +{{ end -}} + +{{ $webp := printf "%s%s" $fillImage " webp" }} +{{/* {{ $image = $image.Resize $webp}} */}} + +{{ $lqip := $image.Resize site.Params.lqipWidth -}} + +{{ .Title }} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/content/figure.html b/code/frontpage/layouts/partials/content/figure.html new file mode 100644 index 0000000..fbb0bde --- /dev/null +++ b/code/frontpage/layouts/partials/content/figure.html @@ -0,0 +1,37 @@ +{{ $fillImage := .Scratch.Get "fillImage" }} +{{ if not $fillImage -}} + {{ $fillImage = site.Params.fillImage }} +{{ end -}} + +{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }} +{{ if not $image -}} + {{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }} +{{ end -}} + +{{ $image = $image.Fill $fillImage }} +{{ $lqip := $image.Resize site.Params.lqipWidth -}} + +{{ $imgSrc := "" -}} +{{ $imgSrcSet := slice -}} + +{{ $widths := site.Params.landscapePhotoWidths -}} +{{ if gt $image.Height $image.Width -}} + {{ $widths = site.Params.portraitPhotoWidths -}} +{{ end -}} + +{{ range $widths -}} + {{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}} + {{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}} + {{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}} +{{ end -}} +{{ $imgSrcSet = (delimit $imgSrcSet ",") -}} + +{{ if gt $image.Width site.Params.smallLimit -}} +
+ {{ .Title }} + + +
+{{ else -}} + {{ .Title }} +{{ end -}} diff --git a/code/frontpage/layouts/partials/content/image.html b/code/frontpage/layouts/partials/content/image.html new file mode 100644 index 0000000..2772531 --- /dev/null +++ b/code/frontpage/layouts/partials/content/image.html @@ -0,0 +1,32 @@ +{{ $image := .Resources.GetMatch (printf "**%s" (index .Params.images 0)) }} +{{ if not $image -}} + {{ $image = resources.Get (printf "%s%s" "images/" site.Params.defaultImage) }} +{{ end -}} + +{{ $image = $image.Fill site.Params.fillImage }} +{{ $lqip := $image.Resize site.Params.lqipWidth -}} + +{{ $imgSrc := "" -}} +{{ $imgSrcSet := slice -}} + +{{ $widths := site.Params.landscapePhotoWidths -}} +{{ if gt $image.Height $image.Width -}} + {{ $widths = site.Params.portraitPhotoWidths -}} +{{ end -}} + +{{ range $widths -}} + {{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}} + {{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}} + {{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}} +{{ end -}} +{{ $imgSrcSet = (delimit $imgSrcSet ",") -}} + +{{ if gt $image.Width site.Params.smallLimit -}} +
+ {{ .Title }} + + +
+{{ else -}} + {{ .Title }} +{{ end -}} diff --git a/code/frontpage/layouts/partials/footer/footer.html b/code/frontpage/layouts/partials/footer/footer.html new file mode 100644 index 0000000..ceb5fae --- /dev/null +++ b/code/frontpage/layouts/partials/footer/footer.html @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/code/frontpage/layouts/partials/footer/script-footer.html b/code/frontpage/layouts/partials/footer/script-footer.html new file mode 100644 index 0000000..8799730 --- /dev/null +++ b/code/frontpage/layouts/partials/footer/script-footer.html @@ -0,0 +1,119 @@ +{{ $indexTemplate := resources.Get "js/index.js" -}} +{{ $index := $indexTemplate | resources.ExecuteAsTemplate "index.js" . -}} + +{{ $bs := resources.Get "js/bootstrap.js" -}} +{{ $bs := $bs | js.Build -}} + +{{ $highlight := resources.Get "js/highlight.js" -}} +{{ $highlight := $highlight | js.Build -}} + +{{ $katex := resources.Get "js/vendor/katex/dist/katex.js" -}} +{{ $katexAutoRender := resources.Get "js/vendor/katex/dist/contrib/auto-render.js" -}} + +{{ $mermaid := resources.Get "js/mermaid.js" | js.Build -}} + +{{ $app := resources.Get "js/app.js" -}} + +{{ $slice := slice $app -}} + +{{ if .Site.Params.options.lazySizes -}} + {{ $lazySizes := resources.Get "js/lazysizes.js" -}} + {{ $lazySizes := $lazySizes | js.Build -}} + {{ $slice = $slice | append $lazySizes -}} +{{ end -}} + +{{ if .Site.Params.options.clipBoard -}} + {{ $clipBoard := resources.Get "js/clipboard.js" -}} + {{ $clipBoard := $clipBoard | js.Build -}} + {{ $slice = $slice | append $clipBoard -}} +{{ end -}} + +{{ if .Site.Params.options.instantPage -}} + {{ $instantPage := resources.Get "js/instant.page.js" -}} + {{ $instantPage := $instantPage | js.Build -}} + {{ $slice = $slice | append $instantPage -}} +{{ end -}} + +{{ $showFlexSearch := .Site.Params.options.flexSearch }} + +{{ if $showFlexSearch -}} + {{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.bundle.js" -}} + {{ $slice = $slice | append $flexSearch -}} + {{ if and (isset .Site.Params.options "searchsectionsshow") (not (eq .Site.Params.options.searchSectionsShow "ALL")) -}} + {{ $showFlexSearch = or (eq (len .Site.Params.options.searchSectionsShow) 0) (in .Site.Params.options.searchSectionsShow .Section) (and .IsHome (in .Site.Params.options.searchSectionsShow "HomePage")) -}} + {{ end -}} +{{ end -}} + +{{ if .Site.Params.options.darkMode -}} + {{ $darkMode := resources.Get "js/darkmode.js" -}} + {{ $darkMode := $darkMode | js.Build -}} + {{ $slice = $slice | append $darkMode -}} +{{ end -}} + +{{ if and (.Site.Params.alert) (.Site.Params.alertDismissable) -}} + {{ $alert := resources.Get "js/alert.js" -}} + {{ $alert := $alert | js.Build -}} + {{ $slice = $slice | append $alert -}} +{{ end -}} + +{{ if .Site.Params.options.kaTex -}} + {{ $katexConfig := resources.Get "js/katex.js" -}} + {{ $katexConfig := $katexConfig | js.Build -}} + {{ $slice = $slice | append $katexConfig -}} +{{ end -}} + +{{ $scrollLock := resources.Get "js/scroll-lock.js" | js.Build -}} +{{ $slice = $slice | append $scrollLock -}} + +{{ if .Site.Params.options.toTopButton -}} + {{ $toTopButton := resources.Get "js/to-top.js" -}} + {{ $toTopButton := $toTopButton | js.Build -}} + {{ $slice = $slice | append $toTopButton -}} +{{ end -}} + +{{ $js := $slice | resources.Concat "main.js" -}} + +{{ if eq (hugo.Environment) "development" -}} + {{ if .Site.Params.options.bootStrapJs -}} + + {{ end -}} + {{ if .Site.Params.options.highLight -}} + + {{ end -}} + {{ if .Site.Params.options.kaTex -}} + + + {{ end -}} + + {{ with .Params.mermaid -}} + + {{ end -}} + {{ if $showFlexSearch -}} + + {{ end -}} +{{ else -}} + {{ $js := $js | minify | fingerprint "sha512" -}} + {{ $index := $index | minify | fingerprint "sha512" -}} + {{ $bs := $bs | minify | fingerprint "sha512" -}} + {{ $highlight := $highlight | minify | fingerprint "sha512" -}} + {{ $katex := $katex | minify | fingerprint "sha512" -}} + {{ $katexAutoRender := $katexAutoRender | minify | fingerprint "sha512" -}} + {{ $mermaid := $mermaid | minify | fingerprint "sha512" -}} + {{ if .Site.Params.options.bootStrapJs -}} + + {{ end -}} + {{ if .Site.Params.options.highLight -}} + + {{ end -}} + {{ if .Site.Params.options.kaTex -}} + + + {{ end -}} + + {{ with .Params.mermaid -}} + + {{ end -}} + {{ if $showFlexSearch -}} + + {{ end -}} +{{ end -}} diff --git a/code/frontpage/layouts/partials/head/custom-head.html b/code/frontpage/layouts/partials/head/custom-head.html new file mode 100644 index 0000000..0c59d7f --- /dev/null +++ b/code/frontpage/layouts/partials/head/custom-head.html @@ -0,0 +1 @@ + diff --git a/code/frontpage/layouts/partials/head/favicons.html b/code/frontpage/layouts/partials/head/favicons.html new file mode 100644 index 0000000..93c5ed5 --- /dev/null +++ b/code/frontpage/layouts/partials/head/favicons.html @@ -0,0 +1,9 @@ + + +{{ if os.FileExists "static/favicon.svg" -}} + +{{ end -}} + + + + diff --git a/code/frontpage/layouts/partials/head/head.html b/code/frontpage/layouts/partials/head/head.html new file mode 100644 index 0000000..12e2a8c --- /dev/null +++ b/code/frontpage/layouts/partials/head/head.html @@ -0,0 +1,11 @@ + + + + + {{ block "head/resource-hints" . }}{{ partial "head/resource-hints.html" . }}{{ end }} + {{ block "head/script-header" . }}{{ partial "head/script-header.html" . }}{{ end }} + {{ block "head/stylesheet" . }}{{ partial "head/stylesheet.html" . }}{{ end }} + {{ block "head/seo" . }}{{ partial "head/seo.html" . }}{{ end }} + {{ block "head/favicons" . }}{{ partial "head/favicons.html" . }}{{ end }} + {{ block "head/custom-head" . }}{{ partial "head/custom-head.html" . }}{{ end }} + diff --git a/code/frontpage/layouts/partials/head/opengraph.html b/code/frontpage/layouts/partials/head/opengraph.html new file mode 100644 index 0000000..6127e82 --- /dev/null +++ b/code/frontpage/layouts/partials/head/opengraph.html @@ -0,0 +1,69 @@ + + + + +{{ if $.Scratch.Get "paginator" -}} + {{ $paginator := .Paginate (where .Site.RegularPages.ByDate.Reverse "Section" "blog" ) -}} + +{{ else -}} + +{{ end -}} +{{ with .Site.Params.title -}} + +{{ end -}} + +{{ $iso8601 := "2006-01-02T15:04:05-07:00" -}} +{{ if .IsPage -}} + {{ if not .PublishDate.IsZero -}} + + {{ else if not .Date.IsZero -}} + + {{ end -}} + {{ if not .Lastmod.IsZero -}} + + {{ end -}} +{{ else -}} + {{ if not .Date.IsZero -}} + + {{ end -}} +{{ end -}} + +{{ if eq .Kind "home" -}} + {{ .Scratch.Set "title" .Site.Params.titleHome -}} +{{ else -}} + {{ .Scratch.Set "title" .Title -}} +{{ end -}} + +{{ with $.Params.images -}} + {{ range first 6 . -}} + + {{ end -}} +{{ else -}} + {{ $images := $.Resources.ByType "image" -}} + {{ $featured := $images.GetMatch "*feature*" -}} + {{ if not $featured -}} + {{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }} + {{ end -}} + {{ with $featured -}} + + {{ else -}} + {{ with $.Site.Params.images -}} + + + {{ end -}} + {{ end -}} +{{ end -}} + +{{ with $.Site.Params.images -}} + {{ $.Scratch.Set "primaryImage" (index . 0 | absURL) -}} +{{ end -}} + +{{ with .Params.audio -}} + +{{ end -}} + +{{ with .Params.videos -}} + {{ range . -}} + + {{ end -}} +{{ end -}} diff --git a/code/frontpage/layouts/partials/head/resource-hints.html b/code/frontpage/layouts/partials/head/resource-hints.html new file mode 100644 index 0000000..6ebcdeb --- /dev/null +++ b/code/frontpage/layouts/partials/head/resource-hints.html @@ -0,0 +1,4 @@ +{{ if .Site.Params.options.kaTex -}} + + +{{ end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/head/script-header.html b/code/frontpage/layouts/partials/head/script-header.html new file mode 100644 index 0000000..38e5b5b --- /dev/null +++ b/code/frontpage/layouts/partials/head/script-header.html @@ -0,0 +1,8 @@ +{{ if .Site.Params.options.darkMode -}} + {{ $darkModeInit := resources.Get "js/darkmode-init.js" | js.Build | minify -}} + +{{ end -}} +{{- if and (.Site.Params.alert) (.Site.Params.alertDismissable) -}} + {{ $alertInit := resources.Get "js/alert-init.js" | js.Build | minify -}} + +{{- end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/head/seo.html b/code/frontpage/layouts/partials/head/seo.html new file mode 100644 index 0000000..ac31d72 --- /dev/null +++ b/code/frontpage/layouts/partials/head/seo.html @@ -0,0 +1,48 @@ +{{ if eq .Kind "404" -}} + +{{ else -}} + {{ with .Params.robots -}} + + {{ else -}} + + + + {{ end -}} +{{ end -}} + +{{ if .IsHome -}} + {{ .Site.Params.title }} {{ .Site.Params.titleSeparator }} {{ .Site.Params.titleAddition }} +{{ else -}} + {{ .Title }} {{ .Site.Params.titleSeparator }} {{ .Site.Params.title }} +{{ end -}} + +{{ with .Description -}} + +{{ else -}} + {{ with .Summary | plainify -}} + + {{ else -}} + + {{ end -}} +{{ end -}} + +{{ if $.Scratch.Get "paginator" }} + + {{ if .Paginator.HasPrev -}} + + {{ end -}} + {{ if .Paginator.HasNext -}} + + {{ end -}} +{{ else -}} + +{{ end -}} + +{{ partial "head/opengraph.html" . }} +{{ partial "head/twitter_cards.html" . }} + +{{ range .AlternativeOutputFormats -}} + +{{ end -}} + +{{ partial "head/structured-data.html" . }} diff --git a/code/frontpage/layouts/partials/head/structured-data.html b/code/frontpage/layouts/partials/head/structured-data.html new file mode 100644 index 0000000..1f153a3 --- /dev/null +++ b/code/frontpage/layouts/partials/head/structured-data.html @@ -0,0 +1,210 @@ +{{ $baseURL := "/" | absURL -}} + +{{ $dot := . -}} +{{ $dot.Scratch.Set "path" "" -}} +{{ $dot.Scratch.Set "breadcrumb" slice -}} + +{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" -}} +{{ $.Scratch.Add "path" .Site.BaseURL -}} + +{{ $.Scratch.Add "breadcrumb" (slice (dict "url" .Site.BaseURL "name" "home" "position" 1 )) -}} + {{ range $index, $element := split $url "/" -}} + {{ $dot.Scratch.Add "path" $element -}} + {{ $.Scratch.Add "path" "/" -}} + {{ if ne $element "" -}} + {{ $.Scratch.Add "breadcrumb" (slice (dict "url" ($.Scratch.Get "path") "name" . "position" (add $index 2))) -}} + {{ end -}} +{{ end -}} + + \ No newline at end of file diff --git a/code/frontpage/layouts/partials/head/stylesheet.html b/code/frontpage/layouts/partials/head/stylesheet.html new file mode 100644 index 0000000..4dc25c0 --- /dev/null +++ b/code/frontpage/layouts/partials/head/stylesheet.html @@ -0,0 +1,11 @@ +{{ if eq (hugo.Environment) "development" -}} + {{ $options := (dict "targetPath" "main.css" "enableSourceMap" true "includePaths" (slice "node_modules")) -}} + {{ $css := resources.Get "scss/app.scss" | toCSS $options -}} + +{{ else -}} + {{ $options := (dict "targetPath" "main.css" "outputStyle" "compressed" "includePaths" (slice "node_modules")) -}} + {{ $css := resources.Get "scss/app.scss" | toCSS $options | postCSS (dict "config" "config/postcss.config.js") -}} + {{ $secureCSS := $css | resources.Fingerprint "sha512" -}} + +{{ end -}} + \ No newline at end of file diff --git a/code/frontpage/layouts/partials/head/twitter_cards.html b/code/frontpage/layouts/partials/head/twitter_cards.html new file mode 100644 index 0000000..fdf581c --- /dev/null +++ b/code/frontpage/layouts/partials/head/twitter_cards.html @@ -0,0 +1,24 @@ + + + + + +{{ with $.Params.images -}} + +{{ else -}} + {{ $images := $.Resources.ByType "image" -}} + {{ $featured := $images.GetMatch "*feature*" -}} + {{ if not $featured -}} + {{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" -}} + {{ end -}} + {{ with $featured -}} + + {{ else -}} + {{ with $.Site.Params.images -}} + + {{ else -}} + + {{ end -}} + {{ end -}} +{{ end -}} + \ No newline at end of file diff --git a/code/frontpage/layouts/partials/header/alert.html b/code/frontpage/layouts/partials/header/alert.html new file mode 100644 index 0000000..7944ae9 --- /dev/null +++ b/code/frontpage/layouts/partials/header/alert.html @@ -0,0 +1,10 @@ +{{ if .Site.Params.alertDismissable -}} + +{{ else -}} + +{{ end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/header/header.html b/code/frontpage/layouts/partials/header/header.html new file mode 100644 index 0000000..7869784 --- /dev/null +++ b/code/frontpage/layouts/partials/header/header.html @@ -0,0 +1,254 @@ +{{ if .Site.Params.alert -}} +{{ partial "header/alert.html" . }} +{{ end -}} + +{{ if eq .Site.Params.options.navbarSticky true -}} +
+ {{ end -}} + + + + {{ if eq .Site.Params.options.navbarSticky true }} +
+{{ end -}} + +{{ if eq .Section "docs" -}} +
+ +
+ +{{ else if ne .CurrentSection .FirstSection -}} +
+ +
+{{ end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/main/blog-meta.html b/code/frontpage/layouts/partials/main/blog-meta.html new file mode 100644 index 0000000..7d11e94 --- /dev/null +++ b/code/frontpage/layouts/partials/main/blog-meta.html @@ -0,0 +1,2 @@ +{{ $last := sub (len .Params.contributors) 1 }} +

Posted{{ if .Params.categories -}} in {{ range $index, $category := .Params.categories -}}{{ if gt $index 0 -}}, {{ end -}}{{ . }}{{ end -}}{{ end -}} on {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }}{{ if eq $index $last }} and {{ else }}, {{ end }}{{ end }}{{ . }}{{ end -}}{{ end -}} ‐ {{ .ReadingTime -}} min read

\ No newline at end of file diff --git a/code/frontpage/layouts/partials/main/breadcrumb.html b/code/frontpage/layouts/partials/main/breadcrumb.html new file mode 100644 index 0000000..1d960d2 --- /dev/null +++ b/code/frontpage/layouts/partials/main/breadcrumb.html @@ -0,0 +1,4 @@ +{{ with .Parent -}} + {{ partial "main/breadcrumb.html" . -}} +

+{{ end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/main/date.html b/code/frontpage/layouts/partials/main/date.html new file mode 100644 index 0000000..4b41ddb --- /dev/null +++ b/code/frontpage/layouts/partials/main/date.html @@ -0,0 +1,6 @@ + +{{ $format := default "January 2, 2006" .Format -}} +{{ return (.Date.Format $format) -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/main/docs-navigation.html b/code/frontpage/layouts/partials/main/docs-navigation.html new file mode 100644 index 0000000..e6a5668 --- /dev/null +++ b/code/frontpage/layouts/partials/main/docs-navigation.html @@ -0,0 +1,24 @@ +{{ if or .Prev .Next -}} +
+ + {{ $pages := where site.RegularPages "Section" .Section -}} + {{ with $pages.Next . -}} + +
+
+ ← {{ .Title }} +
+
+
+ {{ end -}} + {{ with $pages.Prev . -}} + +
+
+ {{ .Title }} → +
+
+
+ {{ end -}} +
+{{ end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/main/edit-page.html b/code/frontpage/layouts/partials/main/edit-page.html new file mode 100644 index 0000000..b69ed36 --- /dev/null +++ b/code/frontpage/layouts/partials/main/edit-page.html @@ -0,0 +1,34 @@ +{{ $parts := slice .Site.Params.docsRepo }} + +{{ if (eq .Site.Params.repoHost "GitHub") }} + {{ $parts = $parts | append "blob" .Site.Params.docsRepoBranch }} +{{ else if (eq .Site.Params.repoHost "Gitea") }} + {{ $parts = $parts | append "_edit" .Site.Params.docsRepoBranch }} +{{ else if (eq .Site.Params.repoHost "GitLab") }} + {{ $parts = $parts | append "-/blob" .Site.Params.docsRepoBranch }} +{{ else if (eq .Site.Params.repoHost "Bitbucket") }} + {{ $parts = $parts | append "src" .Site.Params.docsRepoBranch }} +{{ else if (eq .Site.Params.repoHost "BitbucketServer") }} + {{ $parts = $parts | append "browse" .Site.Params.docsRepoBranch }} +{{ end }} + +{{ if isset .Site.Params "docsreposubpath" }} + {{ if not (eq .Site.Params.docsRepoSubPath "") }} + {{ $parts = $parts | append .Site.Params.docsRepoSubPath }} + {{ end }} +{{ end }} + +{{ $filePath := replace .File.Path "\\" "/" }} + +{{ $parts = $parts | append "content" .Lang $filePath }} + +{{ $url := delimit $parts "/" }} + +
+ + + + + Edit this page on {{ .Site.Params.repoHost }} + +
diff --git a/code/frontpage/layouts/partials/main/last-modified.html b/code/frontpage/layouts/partials/main/last-modified.html new file mode 100644 index 0000000..edb6c7d --- /dev/null +++ b/code/frontpage/layouts/partials/main/last-modified.html @@ -0,0 +1,10 @@ +{{ if and .GitInfo .Site.Params.docsRepo -}} + {{- $date := partial "main/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}} + {{- $commitPath := default "commit" .Site.Params.BookCommitPath -}} +
+ + + Last modified on {{ $date }} + +
+{{ end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html b/code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html new file mode 100644 index 0000000..4600d0a --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/auto-collapsible-menu.html @@ -0,0 +1,57 @@ + + diff --git a/code/frontpage/layouts/partials/sidebar/auto-default-menu.html b/code/frontpage/layouts/partials/sidebar/auto-default-menu.html new file mode 100644 index 0000000..6e4565b --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/auto-default-menu.html @@ -0,0 +1,37 @@ + +{{ $currentPage := . -}} +{{ $section := $currentPage.Section -}} +{{ range (where .Site.Sections "Section" "in" $section) }} + {{ range .Sections }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +

{{ .Title }}

+ + {{ end }} +{{ end }} diff --git a/code/frontpage/layouts/partials/sidebar/docs-menu.html b/code/frontpage/layouts/partials/sidebar/docs-menu.html new file mode 100644 index 0000000..b7baebb --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/docs-menu.html @@ -0,0 +1,9 @@ +{{ if and .Site.Params.menu.section.auto .Site.Params.menu.section.collapsibleSidebar -}} + {{ partial "sidebar/auto-collapsible-menu.html" . -}} +{{ else if and .Site.Params.menu.section.auto (not .Site.Params.menu.section.collapsibleSidebar) -}} + {{ partial "sidebar/auto-default-menu.html" . -}} +{{ else if and (not .Site.Params.menu.section.auto) .Site.Params.menu.section.collapsibleSidebar -}} + {{ partial "sidebar/manual-collapsible-menu.html" . -}} +{{ else if and (not .Site.Params.menu.section.auto) (not .Site.Params.menu.section.collapsibleSidebar) -}} + {{ partial "sidebar/manual-default-menu.html" . -}} +{{ end -}} \ No newline at end of file diff --git a/code/frontpage/layouts/partials/sidebar/docs-toc.html b/code/frontpage/layouts/partials/sidebar/docs-toc.html new file mode 100644 index 0000000..c71a7b8 --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/docs-toc.html @@ -0,0 +1,26 @@ +{{ if and (ne .Params.toc false) (ne .TableOfContents "") -}} +
+ +
+
+ +
+
+
+ +{{ end -}} diff --git a/code/frontpage/layouts/partials/sidebar/manual-collapsible-menu.html b/code/frontpage/layouts/partials/sidebar/manual-collapsible-menu.html new file mode 100644 index 0000000..f83c667 --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/manual-collapsible-menu.html @@ -0,0 +1,63 @@ + + diff --git a/code/frontpage/layouts/partials/sidebar/manual-default-menu.html b/code/frontpage/layouts/partials/sidebar/manual-default-menu.html new file mode 100644 index 0000000..32c4cd4 --- /dev/null +++ b/code/frontpage/layouts/partials/sidebar/manual-default-menu.html @@ -0,0 +1,41 @@ + +{{ $currentPage := . -}} +{{ $section := $currentPage.Section -}} +{{ range (index .Site.Menus $section) -}} +

{{ .Name }}

+ {{ if .HasChildren -}} + + {{ end -}} +{{ end -}} -- cgit v1.3