summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
authoranoduck <11767-anoduck@users.noreply.gitgud.io>2024-09-13 20:22:52 -0400
committeranoduck <11767-anoduck@users.noreply.gitgud.io>2024-09-13 20:23:11 -0400
commit9744378a9b9071872182edb4f151f915ecfa8643 (patch)
treea8c9b8de8e223f6edbecc91b899c2f2a196c712e /layouts
parent5e0f93a81672bacbfd583cfe8cc40f24282af031 (diff)
added tags, working out themeing
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/AddModule.html9
-rw-r--r--layouts/partials/GetIllustration.html22
-rw-r--r--layouts/partials/GetSections.html79
-rw-r--r--layouts/partials/InitModules.html62
-rw-r--r--layouts/partials/git.html3
5 files changed, 175 insertions, 0 deletions
diff --git a/layouts/partials/AddModule.html b/layouts/partials/AddModule.html
new file mode 100644
index 0000000..bd16780
--- /dev/null
+++ b/layouts/partials/AddModule.html
@@ -0,0 +1,9 @@
+{{ with .module }}
+ {{- $dependencies := page.Scratch.Get "dependencies" -}}
+ {{- if reflect.IsSlice $dependencies -}}
+ {{- $dependencies = complement $dependencies . -}}
+ {{ else }}
+ {{- $dependencies = slice . -}}
+ {{ end }}
+ {{- page.Scratch.Set "dependencies" $dependencies -}}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/GetIllustration.html b/layouts/partials/GetIllustration.html
new file mode 100644
index 0000000..1b21f3b
--- /dev/null
+++ b/layouts/partials/GetIllustration.html
@@ -0,0 +1,22 @@
+{{- $item := .item -}}
+{{- $illustration := "" -}}
+{{- $style := "img-wrap mx-auto mx-md-0" -}}
+{{- $size := .size | default "col-12 col-sm-4 col-lg-12" -}}
+
+{{ if $item.Params.icon }}
+ {{- $icon := (or (and (reflect.IsMap $item.Params.Icon) $item.Params.Icon.url) $item.Params.Icon) -}}
+ {{- $mode := and (reflect.IsMap $item.Params.Icon) $item.Params.Icon.mode -}}
+ {{ if eq (lower (path.Ext $icon)) ".json" }}
+ {{ $illustration = partial "assets/animation.html" (dict "data" $icon "mode" $mode "loop" false "hover" true "class" (printf "mx-auto text-center %s" $size)) }}
+ {{ else }}
+ {{ $illustration = partial "assets/icon.html" (dict "icon" "mode" $mode $icon "wrapper" "mx-auto text-center")}}
+ {{ end }}
+{{ else }}
+ {{- $thumbnail := "" -}}
+ {{ if reflect.IsMap $item.Params.Thumbnail }}{{ $thumbnail = $item.Params.Thumbnail.url }}{{ else }}{{ $thumbnail = $item.Params.Thumbnail }}{{ end }}
+ {{- if $thumbnail }}
+ {{ $illustration = partial "assets/image.html" (dict "url" $thumbnail "ratio" "16x9" "wrapper" $style "inner" "rounded" "title" $item.Site.Title) }}
+ {{ end }}
+{{ end }}
+
+{{ return $illustration }} \ No newline at end of file
diff --git a/layouts/partials/GetSections.html b/layouts/partials/GetSections.html
new file mode 100644
index 0000000..393791d
--- /dev/null
+++ b/layouts/partials/GetSections.html
@@ -0,0 +1,79 @@
+{{- $page := .page -}}
+{{- $loading := .loading -}}
+
+{{/* Add title for current page */}}
+{{- $items := slice -}}
+{{ $items = $items | append (dict "title" $page.Title "content" "" )}}
+
+{{/* Identify page sections */}}
+{{- $sections := slice -}}
+{{- $sections = $sections | append $page.Type -}}
+{{ with $page.Params.sections }}
+ {{ $sections = $sections | append . }}
+{{ end }}
+
+{{ if $page.IsHome }}
+ {{- if not $page.Params.sections -}}
+ {{- with site.Params.home.sections }}
+ {{ $sections = $sections | append . }}
+ {{ else }}
+ {{ range $section := site.Sections }}
+ {{ $sections = $sections | append $section.Type }}
+ {{ end }}
+ {{ end }}
+ {{- end -}}
+{{ end }}
+
+{{/* Generate title and content for each section */}}
+{{- range $index, $section := $sections -}}
+ {{- $sectionPage := site.GetPage "section" $section -}}
+ {{- $sectionURL := $sectionPage.RelPermalink -}}
+ {{ with $sectionPage.Params.redirect}}
+ {{ $target := partial "utilities/GetPage.html" (dict "url" . "page" $page) }}
+ {{- if not $target -}}
+ {{ if eq (printf "%T" $page.File) "*hugolib.fileInfo"}}
+ {{- errorf "Cannot find redirect target on page '%s': %s" $page.File . -}}
+ {{ else }}
+ {{- errorf "Cannot find redirect target: %s" . -}}
+ {{ end }}
+ {{ else }}
+ {{- $sectionURL = $target.RelPermalink -}}
+ {{ end }}
+ {{ end }}
+ {{- $title := or $sectionPage.Title $sectionPage.Type -}}
+
+ {{- with (index site.Params.sections $section) -}}
+ {{- with index . "title" }}{{ $title = or . $title }}{{ end -}}
+ {{- end -}}
+
+ {{- $thumbnail := "" -}}
+ {{ if reflect.IsMap $sectionPage.Params.Thumbnail }}{{ $thumbnail = $sectionPage.Params.Thumbnail.url }}{{ else }}{{ $thumbnail = $sectionPage.Params.Thumbnail }}{{ end }}
+ {{- $icon := $sectionPage.Params.Icon -}}
+ {{- $content := "" -}}
+ {{ if not $sectionPage.IsSection }}{{ $content = $sectionPage.Content }}{{ end -}}
+ {{- $sectionTitle := strings.FirstUpper $sectionPage.Type -}}
+ {{- $moreTitle := "" -}}
+ {{- with (index site.Params.sections $section) -}}
+ {{- with index . "reference" }}{{ $moreTitle = . }}{{ end -}}
+ {{- end -}}
+ {{- $moreTitle = or $moreTitle (printf (T "more" (pluralize $sectionTitle))) -}}
+
+ {{- $sectionContent := trim (partial "assets/section-list.html" (dict
+ "page" $page
+ "section" $section
+ "home" $page.IsHome
+ "simple" (eq (len $sections) 1)
+ "thumbnail" $thumbnail
+ "icon" $icon
+ "content" $content
+ "moreTitle" $moreTitle
+ "sectionURL" $sectionURL
+ "loading" $loading)) " \r\n"
+ -}}
+
+ {{ if $sectionContent }}
+ {{ $items = $items | append (dict "title" $title "content" $sectionContent)}}
+ {{ end }}
+{{- end -}}
+
+{{ return $items }} \ No newline at end of file
diff --git a/layouts/partials/InitModules.html b/layouts/partials/InitModules.html
new file mode 100644
index 0000000..0241774
--- /dev/null
+++ b/layouts/partials/InitModules.html
@@ -0,0 +1,62 @@
+{{ $core := slice }}
+{{ $optional := slice }}
+{{ $excludeSCSS := slice }}
+{{ $disableTemplate := slice }}
+{{ $localize := slice }}
+{{ $modules := dict }}
+
+{{ range $key, $mod := .Site.Params.modules }}
+ {{ if eq $key "core" }}
+ {{ warnf "DEPRECATED: module parameter `core` has been deprecated in release v0.24.0" }}
+ {{ $core = $core | append $mod }}
+ {{ else if eq $key "optional" }}
+ {{ warnf "DEPRECATED: module parameter `optional` has been deprecated in release v0.24.0" }}
+ {{ $optional = $optional | append $mod }}
+ {{ else if eq $key "excludescss" }}
+ {{ warnf "DEPRECATED: module parameter `excludeSCSS` has been deprecated in release v0.24.0" }}
+ {{ $excludeSCSS = $excludeSCSS | append $mod }}
+ {{ else if eq $key "disabletemplate" }}
+ {{ warnf "DEPRECATED: module parameter `disableTemplate` has been deprecated in release v0.24.0" }}
+ {{ $disableTemplate = $disableTemplate | append $mod }}
+ {{ else if reflect.IsMap $mod }}
+ {{ $integration := index $mod "integration" }}
+ {{ if eq $integration "core" }}
+ {{ $core = $core | append $key }}
+ {{ else if eq $integration "optional" }}
+ {{ $optional = $optional | append $key }}
+ {{ else if $integration }}
+ {{ warnf "Unrecognized module integration setting: %s" $integration }}
+ {{ end }}
+
+ {{ if eq (index $mod "excludeSCSS") true }}
+ {{ $excludeSCSS = $excludeSCSS | append $key }}
+ {{ end }}
+
+ {{ if eq (index $mod "disableTemplate") true }}
+ {{ $disableTemplate = $disableTemplate | append $key }}
+ {{ end }}
+
+ {{ if eq (index $mod "localize") true }}
+ {{ $localize = $localize | append $key }}
+ {{ end }}
+
+ {{ $modules = merge $modules (dict $key $mod) }}
+ {{ else }}
+ {{ warnf "Unsupported module parameter: %s" $key }}
+ {{ end }}
+{{ end }}
+
+{{ $modules := dict
+ "modules" $modules
+ "core" $core
+ "optional" $optional
+ "excludeSCSS" $excludeSCSS
+ "disableTemplate" $disableTemplate
+ "localize" $localize
+}}
+
+{{- if and .IsPage (not (in $core "bootstrap")) -}}
+ {{- errorf "Bootstrap is a required module, please add it to 'modules.core' in your site parameters" -}}
+{{- end -}}
+
+{{ return $modules }} \ No newline at end of file
diff --git a/layouts/partials/git.html b/layouts/partials/git.html
new file mode 100644
index 0000000..58f9ff2
--- /dev/null
+++ b/layouts/partials/git.html
@@ -0,0 +1,3 @@
+{{ with .GitInfo }}
+&bull;&nbsp;<a href="{{ site.Params.docs.github | default site.Params.schema.github }}/commit/{{ .Hash }}">{{ .Subject }} ({{ .AbbreviatedHash }})</a>
+{{ end -}} \ No newline at end of file