aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-10-02 09:02:20 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-10-02 09:02:20 +0200
commit2c17fbcdf8ea36d9d10dba243db94de85575e8ed (patch)
tree6609bbe9837d851f3d0be160f025285606465dc4
parentc6ef2fd7aeff28abfd4ec372262de3ecd4684c04 (diff)
chore: Copy theme layouts
-rw-r--r--layouts/404.html12
-rw-r--r--layouts/_default/baseof.html13
-rw-r--r--layouts/_default/list.html17
-rw-r--r--layouts/_default/single.html3
-rw-r--r--layouts/index.html17
-rw-r--r--layouts/partials/footer.html4
-rw-r--r--layouts/partials/footer/copyright.html3
-rw-r--r--layouts/partials/footer/social.html5
-rw-r--r--layouts/partials/handler/svg.html6
-rw-r--r--layouts/partials/head.html2
-rw-r--r--layouts/partials/head/styles.html13
-rw-r--r--layouts/partials/header.html7
-rw-r--r--layouts/partials/header/avatar.html7
-rw-r--r--layouts/partials/header/nav.html10
-rw-r--r--layouts/partials/header/title.html7
-rw-r--r--layouts/partials/list/categories.html3
-rw-r--r--layouts/partials/list/components/pagination.html25
-rw-r--r--layouts/partials/list/default.html11
-rw-r--r--layouts/partials/single/components/comments/comments.html11
-rw-r--r--layouts/partials/single/components/comments/disqus.html4
-rw-r--r--layouts/partials/single/components/comments/giscus.html21
-rw-r--r--layouts/partials/single/components/metatag/categories.html8
-rw-r--r--layouts/partials/single/components/metatag/tags.html9
-rw-r--r--layouts/partials/single/components/metatag/time.html4
-rw-r--r--layouts/partials/single/components/title/large.html1
-rw-r--r--layouts/partials/single/components/title/small.html1
-rw-r--r--layouts/partials/single/default.html17
-rw-r--r--layouts/partials/single/homepage.html8
-rw-r--r--layouts/robot.txt4
-rw-r--r--layouts/shortcodes/begin-task-list.html1
-rw-r--r--layouts/shortcodes/img.html23
-rw-r--r--layouts/taxonomies/home.html17
32 files changed, 294 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html
new file mode 100644
index 0000000..d042ff8
--- /dev/null
+++ b/layouts/404.html
@@ -0,0 +1,12 @@
+{{ define "main" }}
+
+<article class="flex flex-col gap-3">
+ <header>
+ <h2 class="text-2xl font-extrabold text-gray-900">{{ .Title }}</h2>
+ </header>
+ <section class="content text-lg text-gray-800">
+ Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
+ </section>
+</article>
+
+{{ end }} \ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
new file mode 100644
index 0000000..69be8f7
--- /dev/null
+++ b/layouts/_default/baseof.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.LanguageCode | default `en` }}" class="scroll-smooth">
+ <head>
+ {{- partial "head.html" . -}}
+ </head>
+ <body class="max-w-screen-md px-10 mx-auto">
+ {{ partial "header.html" . }}
+ <main id="content">
+ {{- block "main" . }}{{- end }}
+ </main>
+ {{- partial "footer.html" . -}}
+ </body>
+</html>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
new file mode 100644
index 0000000..577852f
--- /dev/null
+++ b/layouts/_default/list.html
@@ -0,0 +1,17 @@
+{{ define "main" }}
+{{ $pages := .Pages }}
+{{ $paginator := .Paginate $pages }}
+<div class="flex flex-col gap-1">
+<h1 class="text-2xl font-extrabold">{{ if .Params.header }}{{ .Params.header }}{{ else }}{{ .Title }}{{ end }}</h1>
+{{ if .Content }}<p class="content text-lg text-gray-900">{{ .Content }}</p>{{ end }}
+</div>
+
+<section class="py-10 flex flex-col gap-10 ">
+{{ range $index, $pages := $paginator.Pages }}
+ {{ partial "list/default" . }}
+{{ end }}
+</section>
+
+{{ partial "list/components/pagination" . }}
+
+{{ 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..13aa7d0
--- /dev/null
+++ b/layouts/_default/single.html
@@ -0,0 +1,3 @@
+{{ define "main" }}
+{{ partial "single/default" . }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/index.html b/layouts/index.html
new file mode 100644
index 0000000..7f31f64
--- /dev/null
+++ b/layouts/index.html
@@ -0,0 +1,17 @@
+{{ define "main" }}
+{{ if site.Params.isSinglePage }}
+{{ partial "single/homepage" . }}
+{{ else }}
+{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
+{{ $paginator := .Paginate $pages }}
+<div class="flex flex-col gap-1">
+<h3 class="text-2xl font-extrabold">Latest Posts</h3>
+</div>
+<section class="py-10 flex flex-col gap-10 ">
+{{ range $index, $pages := $paginator.Pages }}
+ {{ partial "list/default" . }}
+{{ end }}
+</section>
+{{ partial "list/components/pagination" . }}
+{{ 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..73f32ae
--- /dev/null
+++ b/layouts/partials/footer.html
@@ -0,0 +1,4 @@
+<footer class="pt-5 pb-10 grid gap-3 sm:grid-cols-2">
+ {{ partial "footer/copyright" . }}
+ {{ partial "footer/social" . }}
+</footer> \ No newline at end of file
diff --git a/layouts/partials/footer/copyright.html b/layouts/partials/footer/copyright.html
new file mode 100644
index 0000000..b24cc2c
--- /dev/null
+++ b/layouts/partials/footer/copyright.html
@@ -0,0 +1,3 @@
+<div class="text-xs font-semibold text-gray-500 order-2 sm:order-1 ">
+ © {{ replace .Site.Copyright "{year}" now.Year }} — <a class="hover:text-gray-500" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> <span class=" font-normal ">with</span> <a class="hover:text-gray-500" href="https://github.com/nixentric/Lowkey-Hugo-Theme" target="_blank" rel="noopener noreferrer">Lowkey</a>
+</div> \ No newline at end of file
diff --git a/layouts/partials/footer/social.html b/layouts/partials/footer/social.html
new file mode 100644
index 0000000..0b70dd6
--- /dev/null
+++ b/layouts/partials/footer/social.html
@@ -0,0 +1,5 @@
+<div class="text-xs font-semibold text-gray-500 order-1 sm:order-2">
+ <ul class="flex sm:justify-end gap-5">
+ {{ with site.Menus.social }}{{ range . }}<li><a class="hover:text-gray-500" href="{{ .URL }}" target="_blank" rel="noopener noreferrer">{{ .Name }}</a></li>{{ end }}{{ end }}
+ </ul>
+</div> \ No newline at end of file
diff --git a/layouts/partials/handler/svg.html b/layouts/partials/handler/svg.html
new file mode 100644
index 0000000..72162e8
--- /dev/null
+++ b/layouts/partials/handler/svg.html
@@ -0,0 +1,6 @@
+{{- $iconFile := resources.GetMatch (printf "icons/%s.svg" .) -}}
+{{- if $iconFile -}}
+ {{- $iconFile.Content | safeHTML -}}
+{{- else -}}
+ {{- errorf "Error: icon '%s.svg' is not found under 'assets/icons' folder" . -}}
+{{- end -}} \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
new file mode 100644
index 0000000..27e7b20
--- /dev/null
+++ b/layouts/partials/head.html
@@ -0,0 +1,2 @@
+{{- partial "head/meta.html" . -}}
+{{- partial "head/styles.html" . -}}
diff --git a/layouts/partials/head/styles.html b/layouts/partials/head/styles.html
new file mode 100644
index 0000000..68577ce
--- /dev/null
+++ b/layouts/partials/head/styles.html
@@ -0,0 +1,13 @@
+{{/* Resources */}}
+{{- $tailwind := resources.Get "css/tailwind.css" | postCSS (dict "config" "./config/postcss.config.js") -}}
+
+{{/* Processor */}}
+{{- $styles := slice $tailwind | resources.Concat "css/app.css" -}}
+
+{{/* Output */}}
+{{- if eq hugo.Environment "development" -}}
+<link rel="stylesheet" href="{{ $styles.Permalink | absURL }}">
+{{- else -}}
+{{- $styles := $styles | minify | fingerprint | resources.PostProcess -}}
+<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" >
+{{- end -}}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644
index 0000000..cdfb463
--- /dev/null
+++ b/layouts/partials/header.html
@@ -0,0 +1,7 @@
+<header class="flex flex-col sm:flex-row items-center gap-5 sm:gap-10 pt-16 py-12">
+ {{ partial "header/avatar.html" . }}
+ <div class="flex flex-col gap-5">
+ {{ partial "header/title.html" . }}
+ {{ partial "header/nav.html" . }}
+ </div>
+</header> \ No newline at end of file
diff --git a/layouts/partials/header/avatar.html b/layouts/partials/header/avatar.html
new file mode 100644
index 0000000..e3c1021
--- /dev/null
+++ b/layouts/partials/header/avatar.html
@@ -0,0 +1,7 @@
+{{ $avatar := resources.GetMatch .Site.Params.avatar }}
+{{ $tiny := ($avatar.Fill "80x80 q90") }}
+<div class="flex-none w-20 h-20 rounded-full overflow-hidden" >
+ <a href="{{ .Site.BaseURL }}">
+ <img srcset="{{- with $tiny.RelPermalink -}}{{.}} 80w{{- end -}}" src="{{ $avatar.RelPermalink }}" width="{{ $avatar.Width }}" height="{{ $avatar.Height }}" alt="{{ .Site.Title }}">
+ </a>
+</div>
diff --git a/layouts/partials/header/nav.html b/layouts/partials/header/nav.html
new file mode 100644
index 0000000..c0c20b3
--- /dev/null
+++ b/layouts/partials/header/nav.html
@@ -0,0 +1,10 @@
+<nav>
+ <ul class="flex flex-wrap justify-center uppercase text-xs font-semibold gap-7 text-gray-500 ">
+ {{ $currentPage := . }}
+ {{ range site.Menus.main }}
+ {{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
+ {{- $page_url:= $currentPage.Permalink | absLangURL }}
+ <li class="{{- if eq $menu_item_url $page_url }}text-gray-900{{else}}hover:text-gray-500{{ end -}}"><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{ end }}
+ </ul>
+</nav> \ No newline at end of file
diff --git a/layouts/partials/header/title.html b/layouts/partials/header/title.html
new file mode 100644
index 0000000..d6e6ba3
--- /dev/null
+++ b/layouts/partials/header/title.html
@@ -0,0 +1,7 @@
+<a href="{{ .Site.BaseURL }}">
+ {{ if .IsHome }}
+ <h1 class="text-center sm:text-left text-4xl font-extrabold text-gray-800 ">{{ .Site.Title }}</h1>
+ {{ else }}
+ <h3 class="text-center sm:text-left text-4xl font-extrabold text-gray-800 ">{{ .Site.Title }}</h3>
+ {{ end }}
+</a> \ No newline at end of file
diff --git a/layouts/partials/list/categories.html b/layouts/partials/list/categories.html
new file mode 100644
index 0000000..db527c6
--- /dev/null
+++ b/layouts/partials/list/categories.html
@@ -0,0 +1,3 @@
+<li>
+ <a class="bg-gray-100 hover:bg-gray-200 transition-all duration-500 py-2 px-3 rounded-lg" href=" {{ .Permalink }} ">{{ .Title }} ({{ len .Pages }})</a>
+</li>
diff --git a/layouts/partials/list/components/pagination.html b/layouts/partials/list/components/pagination.html
new file mode 100644
index 0000000..07b3e74
--- /dev/null
+++ b/layouts/partials/list/components/pagination.html
@@ -0,0 +1,25 @@
+{{ $paginator := .Paginator }}
+
+<div class="pb-10 grid grid-cols-2 font-semibold">
+
+ <!-- Previous page. -->
+ <div>
+ {{ if $paginator.HasPrev }}
+ <a href="{{ $paginator.Prev.URL }}" class="inline-flex items-center gap-2">
+ <span class="h-4 w-4 stroke-2"> {{ partial "handler/svg" "arrow-left" }} </span>
+ Newer Posts
+ </a>
+ {{ end }}
+ </div>
+
+ <div class="flex justify-end">
+ <!-- Next page. -->
+ {{ if $paginator.HasNext }}
+ <a href="{{ $paginator.Next.URL }}" class="inline-flex items-center gap-2">
+ Older Posts
+ <span class="h-4 w-4 stroke-2"> {{ partial "handler/svg" "arrow-right" }} </span>
+ </a>
+ {{ end }}
+ </div>
+
+</div>
diff --git a/layouts/partials/list/default.html b/layouts/partials/list/default.html
new file mode 100644
index 0000000..a965ce5
--- /dev/null
+++ b/layouts/partials/list/default.html
@@ -0,0 +1,11 @@
+<article class="flex flex-col gap-1">
+ <h1 class="text-xl font-bold hover:underline"> <a href=" {{ .Permalink }} ">{{ .Title }}</a></h1>
+ <div class="text-gray-600">
+ {{ if .Params.description }}
+ {{ .Params.description }}
+ {{ else if .Summary }}
+ {{ .Summary }}
+ {{ end }}
+ </div>
+ <div class="mt-2"><a class="inline-flex gap-2 text-sm font-semibold items-center text-emerald-700 hover:text-emerald-600" href="{{ .Permalink }}">Read This Article <span class="w-4 h-4 stroke-2">{{ partial "handler/svg" "arrow-right" }}</span> </a> </div>
+</article> \ No newline at end of file
diff --git a/layouts/partials/single/components/comments/comments.html b/layouts/partials/single/components/comments/comments.html
new file mode 100644
index 0000000..2eae412
--- /dev/null
+++ b/layouts/partials/single/components/comments/comments.html
@@ -0,0 +1,11 @@
+{{ if .IsPage }}
+ <!-- giscus -->
+ {{ if .Site.Params.giscus.enable }}
+ {{ partial "single/components/comments/giscus" . }}
+ {{ end }}
+
+ <!-- disqus -->
+ {{ if .Site.Params.disqusShortname }}
+ {{ partial "single/components/comments/disqus" . }}
+ {{ end }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/single/components/comments/disqus.html b/layouts/partials/single/components/comments/disqus.html
new file mode 100644
index 0000000..b794098
--- /dev/null
+++ b/layouts/partials/single/components/comments/disqus.html
@@ -0,0 +1,4 @@
+<div class="disqus-comment">
+ {{/* https://gohugo.io/templates/internal/#disqus */}}
+ {{- template "_internal/disqus.html" . -}}
+</div> \ No newline at end of file
diff --git a/layouts/partials/single/components/comments/giscus.html b/layouts/partials/single/components/comments/giscus.html
new file mode 100644
index 0000000..4daa23a
--- /dev/null
+++ b/layouts/partials/single/components/comments/giscus.html
@@ -0,0 +1,21 @@
+<div class="giscus-comment">
+ <script
+ src="https://giscus.app/client.js"
+ data-repo="{{ .Site.Params.giscus.repo }}"
+ data-repo-id="{{ .Site.Params.giscus.repoId }}"
+ data-category="{{ .Site.Params.giscus.category }}"
+ data-category-id="{{ .Site.Params.giscus.categoryId }}"
+ data-mapping="{{ .Site.Params.giscus.mapping | default `pathname` }}"
+ data-strict="{{ (string .Site.Params.giscus.strict) | default 0 }}"
+ data-reactions-enabled="{{ (string .Site.Params.giscus.reactionsEnabled) | default 1 }}"
+ data-emit-metadata="{{ (string .Site.Params.giscus.emitMetadata) | default 0 }}"
+ data-input-position="{{ .Site.Params.giscus.inputPosition | default `top` }}"
+ data-theme="{{ .Site.Params.giscus.theme | default `light` }}"
+ data-lang="{{ .Site.Params.giscus.lang | default `en` }}"
+ {{ if .Site.Params.giscus.lazyLoading }}
+ data-loading="lazy"
+ {{ end }}
+ crossorigin="anonymous"
+ async
+ ></script>
+</div> \ No newline at end of file
diff --git a/layouts/partials/single/components/metatag/categories.html b/layouts/partials/single/components/metatag/categories.html
new file mode 100644
index 0000000..1d0f808
--- /dev/null
+++ b/layouts/partials/single/components/metatag/categories.html
@@ -0,0 +1,8 @@
+{{ with (.GetTerms "categories") }}
+ —
+ {{ range . }}
+ <a class="hover:text-gray-500" href="{{ .RelPermalink }}" alt="{{ .LinkTitle }}" >
+ {{ .LinkTitle }}
+ </a>
+ {{ end }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/single/components/metatag/tags.html b/layouts/partials/single/components/metatag/tags.html
new file mode 100644
index 0000000..800ebc2
--- /dev/null
+++ b/layouts/partials/single/components/metatag/tags.html
@@ -0,0 +1,9 @@
+{{ with (.GetTerms "tags") }}
+ <div class="pb-14 taxonomy-list tags-list text-gray-600 text-sm font-medium">
+ {{ range . }}
+ <a class="bg-gray-100 py-2 px-3 rounded-lg" href="{{ .RelPermalink }}" alt="{{ .LinkTitle }}" >
+ {{ .LinkTitle }}
+ </a>
+ {{ end }}
+ </div>
+{{ end }}
diff --git a/layouts/partials/single/components/metatag/time.html b/layouts/partials/single/components/metatag/time.html
new file mode 100644
index 0000000..4575fc0
--- /dev/null
+++ b/layouts/partials/single/components/metatag/time.html
@@ -0,0 +1,4 @@
+{{- $pubdate := .PublishDate.Format "2 January 2006" }}
+<time datetime="{{ .PublishDate }}" title="{{ .PublishDate }}">
+ {{ $pubdate }}
+</time> \ No newline at end of file
diff --git a/layouts/partials/single/components/title/large.html b/layouts/partials/single/components/title/large.html
new file mode 100644
index 0000000..20b9b3f
--- /dev/null
+++ b/layouts/partials/single/components/title/large.html
@@ -0,0 +1 @@
+<h2 class="text-4xl leading-snug font-bold text-gray-900">{{ .Title }}</h2>
diff --git a/layouts/partials/single/components/title/small.html b/layouts/partials/single/components/title/small.html
new file mode 100644
index 0000000..bda0a1e
--- /dev/null
+++ b/layouts/partials/single/components/title/small.html
@@ -0,0 +1 @@
+<h2 class="text-2xl font-extrabold text-gray-900">{{ .Title }}</h2> \ No newline at end of file
diff --git a/layouts/partials/single/default.html b/layouts/partials/single/default.html
new file mode 100644
index 0000000..2d2ad63
--- /dev/null
+++ b/layouts/partials/single/default.html
@@ -0,0 +1,17 @@
+<article class="flex flex-col gap-10">
+ <header class="flex flex-col gap-2">
+ {{ partial "single/components/title/large" . }}
+ <div class="text-sm font-semibold text-gray-500 flex gap-3">
+ {{ partial "single/components/metatag/time" . }}
+ {{ partial "single/components/metatag/categories" . }}
+ </div>
+ </header>
+ <section class="content text-lg text-gray-800">
+ {{/* {{.TableOfContents}} */}}
+ {{ .Content | emojify }}
+ </section>
+ {{ partial "single/components/comments/comments" . }}
+ <footer>
+ {{ partial "single/components/metatag/tags" . }}
+ </footer>
+</article> \ No newline at end of file
diff --git a/layouts/partials/single/homepage.html b/layouts/partials/single/homepage.html
new file mode 100644
index 0000000..2e80535
--- /dev/null
+++ b/layouts/partials/single/homepage.html
@@ -0,0 +1,8 @@
+<article class="flex flex-col gap-5">
+ <header class="flex flex-col gap-2">
+ {{ partial "single/components/title/small" . }}
+ </header>
+ <section class="content text-lg text-gray-800">
+ {{ .Content | emojify }}
+ </section>
+</article> \ No newline at end of file
diff --git a/layouts/robot.txt b/layouts/robot.txt
new file mode 100644
index 0000000..ac68366
--- /dev/null
+++ b/layouts/robot.txt
@@ -0,0 +1,4 @@
+User-agent: *
+{{ range .Pages }}
+Disallow: {{ .RelPermalink }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/shortcodes/begin-task-list.html b/layouts/shortcodes/begin-task-list.html
new file mode 100644
index 0000000..73a7776
--- /dev/null
+++ b/layouts/shortcodes/begin-task-list.html
@@ -0,0 +1 @@
+<span class="begin-task-list"></span>
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html
new file mode 100644
index 0000000..a0673a3
--- /dev/null
+++ b/layouts/shortcodes/img.html
@@ -0,0 +1,23 @@
+{{/* Image Resources */}}
+{{ $img := .Page.Resources.GetMatch (printf "%s" (.Get "src" | safeURL ))}}
+{{ $alt := .Get "alt"}}
+
+{{/* Image Processing */}}
+{{ $command := .Get "size-method" }}
+{{ $options := .Get "size-format" }}
+{{ if eq $command "Fit"}}
+ {{ $img = $img.Fit $options }}
+{{ else if eq $command "Resize"}}
+ {{ $img = $img.Resize $options }}
+{{ else if eq $command "Fill"}}
+ {{ $img = $img.Fill $options }}
+{{ else if eq $command "Crop"}}
+ {{ $img = $img.Crop $options }}
+{{ end }}
+
+{{/* Position */}}
+{{ $position := .Get "position" }}
+
+<figure class='mb-5{{ if eq $position "center" }} flex justify-center{{ end }}'>
+ <img src="{{ $img.RelPermalink }}" {{ with $alt }}alt="{{ . }}"{{end}} width="{{ $img.Width }}" height="{{ $img.Height }}" >
+</figure> \ No newline at end of file
diff --git a/layouts/taxonomies/home.html b/layouts/taxonomies/home.html
new file mode 100644
index 0000000..6a7dce5
--- /dev/null
+++ b/layouts/taxonomies/home.html
@@ -0,0 +1,17 @@
+{{ define "main" }}
+{{ $pages := .Pages }}
+<div class="flex flex-col gap-1">
+<h1 class="text-2xl font-extrabold">{{ if .Params.header }}{{ .Params.header }}{{ else }}{{ .Title }}{{ end }}</h1>
+{{ if .Content }}<p class="content text-lg text-gray-900">{{ .Content }}</p>{{ end }}
+</div>
+
+<section class="py-10 flex flex-col gap-10 ">
+<ul class="taxonomy-list">
+ {{ range $index, $pages}}
+ {{ partial "list/categories" . }}
+ {{ end }}
+</ul>
+</section>
+
+
+{{ end }}