From 900bb5e845c3ad44defbd427cae3d44a4a43321f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 25 Feb 2023 13:15:44 +0100 Subject: feat: Initial commit --- .../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 +++++++ 6 files changed, 80 insertions(+) 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 (limited to 'code/frontpage/layouts/partials/main') 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 -- cgit v1.3