aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/footer/copyright.html15
-rw-r--r--layouts/partials/footer/index.html4
-rw-r--r--layouts/partials/footer/social.html16
-rw-r--r--layouts/partials/head/index.html2
-rw-r--r--layouts/partials/head/meta.html42
-rw-r--r--layouts/partials/head/styles.html22
-rw-r--r--layouts/partials/header/avatar.html17
-rw-r--r--layouts/partials/header/index.html8
-rw-r--r--layouts/partials/header/nav.html22
-rw-r--r--layouts/partials/header/theme-button.html47
-rw-r--r--layouts/partials/header/title.html8
-rw-r--r--layouts/partials/list/default.html33
-rw-r--r--layouts/partials/list/pagination.html23
-rw-r--r--layouts/partials/single/comments/disqus.html4
-rw-r--r--layouts/partials/single/comments/giscus.html22
-rw-r--r--layouts/partials/single/comments/index.html11
-rw-r--r--layouts/partials/single/table-of-contents.html6
-rw-r--r--layouts/partials/utils/icon.html7
18 files changed, 253 insertions, 56 deletions
diff --git a/layouts/partials/footer/copyright.html b/layouts/partials/footer/copyright.html
index b24cc2c..d2c9828 100644
--- a/layouts/partials/footer/copyright.html
+++ b/layouts/partials/footer/copyright.html
@@ -1,3 +1,12 @@
-<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
+<div class="text-xs font-semibold text-gray-500 order-2 sm:order-1">
+ © {{ replace .Site.Copyright "{year}" now.Year }} —
+ <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
+ <span class="font-normal">with</span>
+ <a
+ href="https://github.com/nixentric/Lowkey-Hugo-Theme"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Lowkey
+ </a>
+</div>
diff --git a/layouts/partials/footer/index.html b/layouts/partials/footer/index.html
new file mode 100644
index 0000000..73f32ae
--- /dev/null
+++ b/layouts/partials/footer/index.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/social.html b/layouts/partials/footer/social.html
index 0b70dd6..ddf867c 100644
--- a/layouts/partials/footer/social.html
+++ b/layouts/partials/footer/social.html
@@ -1,5 +1,11 @@
-<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
+<div class="order-1 sm:order-2">
+ <ul class="flex sm:justify-end gap-5">
+ {{ with site.Menus.social }}
+ {{ range . }}
+ <li>
+ <a href="{{ .URL }}" target="_blank" rel="me noopener noreferrer">{{ .Name }}</a>
+ </li>
+ {{ end }}
+ {{ end }}
+ </ul>
+</div>
diff --git a/layouts/partials/head/index.html b/layouts/partials/head/index.html
new file mode 100644
index 0000000..eb096b8
--- /dev/null
+++ b/layouts/partials/head/index.html
@@ -0,0 +1,2 @@
+{{- partial "head/meta" . -}}
+{{- partial "head/styles" . -}}
diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html
index 23a770a..329d9bf 100644
--- a/layouts/partials/head/meta.html
+++ b/layouts/partials/head/meta.html
@@ -1,12 +1,32 @@
-<meta charset="UTF-8">
-<meta http-equiv="X-UA-Compatible" content="IE=edge">
-<meta name="viewport" content="width=device-width, initial-scale=1.0">
+{{ $favicon := resources.GetMatch .Site.Params.favicon }}
+
+<meta charset="UTF-8" />
+<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}</title>
-<meta name="description"
- content="{{ if .IsPage }}{{ or .Params.description .Summary }}{{ else if .IsHome }}{{ .Site.Params.description }}{{ else if .IsNode }}{{ or .Params.description .Summary }}{{ end }}">
-<link rel="canonical" href="{{ .Permalink }}">
-<link rel="robots" href="/robots.txt" />
-{{ with .OutputFormats.Get "rss" -}}
-{{ printf `
-<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
-{{ end }} \ No newline at end of file
+<meta
+ name="description"
+ content="{{ if .IsPage }}{{ or .Params.description .Summary }}{{ else if .IsHome }}{{ .Site.Params.description }}{{ else if .IsNode }}{{ or .Params.description .Summary }}{{ end }}"
+/>
+<link rel="canonical" href="{{ .Permalink }}" />
+<link rel="robots" href="/robot.txt" />
+
+<link rel="icon" type="image/x-icon" href="{{ $favicon.RelPermalink }}" />
+
+{{ if .Site.Config.Services.GoogleAnalytics.ID }}
+<!-- Google Analytics -->
+<script
+ defer
+ src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Config.Services.GoogleAnalytics.ID }}"
+></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag() {
+ dataLayer.push(arguments);
+ }
+ gtag('js', new Date());
+
+ gtag('config', '{{ .Site.Config.Services.GoogleAnalytics.ID }}');
+</script>
+<!-- End Google Analytics -->
+{{ end }}
diff --git a/layouts/partials/head/styles.html b/layouts/partials/head/styles.html
index 68577ce..cfab45a 100644
--- a/layouts/partials/head/styles.html
+++ b/layouts/partials/head/styles.html
@@ -1,13 +1,17 @@
-{{/* Resources */}}
-{{- $tailwind := resources.Get "css/tailwind.css" | postCSS (dict "config" "./config/postcss.config.js") -}}
+{{/* Resources */}}
+{{- $tailwind := resources.Get "css/tailwind.css" | postCSS (dict "config" "./config/postcss.config.js") -}}
-{{/* Processor */}}
-{{- $styles := slice $tailwind | resources.Concat "css/app.css" -}}
+{{/* MathJax */}}
+<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+<script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } });</script>
-{{/* Output */}}
+{{/* 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 }}" >
+ <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/avatar.html b/layouts/partials/header/avatar.html
index e3c1021..5c9447d 100644
--- a/layouts/partials/header/avatar.html
+++ b/layouts/partials/header/avatar.html
@@ -1,7 +1,14 @@
-{{ $avatar := resources.GetMatch .Site.Params.avatar }}
+{{ $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 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/index.html b/layouts/partials/header/index.html
new file mode 100644
index 0000000..43debba
--- /dev/null
+++ b/layouts/partials/header/index.html
@@ -0,0 +1,8 @@
+<header class="flex flex-col sm:flex-row items-center gap-5 sm:gap-10 pt-16 py-12">
+ {{ partial "header/avatar" . }}
+
+ <div class="flex flex-col gap-5">
+ {{ partial "header/title" . }}
+ {{ partial "header/nav" . }}
+ </div>
+</header>
diff --git a/layouts/partials/header/nav.html b/layouts/partials/header/nav.html
index c0c20b3..94b073d 100644
--- a/layouts/partials/header/nav.html
+++ b/layouts/partials/header/nav.html
@@ -1,10 +1,14 @@
<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
+ <ul>
+ {{ $currentPage := . }}
+ {{ range site.Menus.main }}
+ {{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
+ {{- $page_url := $currentPage.Permalink | absLangURL }}
+ <li>
+ <a href="{{ .URL }}" class="{{ if eq $menu_item_url $page_url }} active {{ end }}">
+ {{ .Name }}
+ </a>
+ </li>
+ {{ end }}
+ </ul>
+</nav>
diff --git a/layouts/partials/header/theme-button.html b/layouts/partials/header/theme-button.html
new file mode 100644
index 0000000..0a8313b
--- /dev/null
+++ b/layouts/partials/header/theme-button.html
@@ -0,0 +1,47 @@
+<button class="toggle-theme" aria-label="Toggle Theme" title="Toggle Theme" onclick="toggleTheme()">
+ <span class="theme-icon light"> {{ partial "utils/icon" "sun" }} </span>
+ <span class="theme-icon dark"> {{ partial "utils/icon" "moon" }} </span>
+</button>
+
+<script>
+ document.addEventListener('DOMContentLoaded', function () {
+ const theme = localStorage.getItem('theme');
+
+ if (!theme || theme === 'light') {
+ setTheme('light');
+ } else {
+ setTheme(theme);
+ }
+ });
+
+ function setTheme(theme) {
+ const html = document.querySelector('html');
+ localStorage.setItem('theme', theme);
+
+ if (theme === 'light') {
+ if (html.classList.contains('dark')) {
+ document.querySelector('html').classList.remove('dark');
+ }
+
+ document.querySelector('.theme-icon.light').style.display = 'none';
+ document.querySelector('.theme-icon.dark').style.display = 'block';
+ } else {
+ if (!html.classList.contains('dark')) {
+ document.querySelector('html').classList.add('dark');
+ }
+
+ document.querySelector('.theme-icon.dark').style.display = 'none';
+ document.querySelector('.theme-icon.light').style.display = 'block';
+ }
+ }
+
+ function toggleTheme() {
+ const theme = localStorage.getItem('theme');
+
+ if (theme === 'light') {
+ setTheme('dark');
+ } else {
+ setTheme('light');
+ }
+ }
+</script> \ No newline at end of file
diff --git a/layouts/partials/header/title.html b/layouts/partials/header/title.html
index d6e6ba3..11bc434 100644
--- a/layouts/partials/header/title.html
+++ b/layouts/partials/header/title.html
@@ -1,7 +1,3 @@
<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
+ <h1 id="site-title">{{ .Site.Title }}</h1>
+</a>
diff --git a/layouts/partials/list/default.html b/layouts/partials/list/default.html
index a965ce5..f3fd20e 100644
--- a/layouts/partials/list/default.html
+++ b/layouts/partials/list/default.html
@@ -1,11 +1,28 @@
<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">
+ <h1>
+ <a href="{{ .Permalink }}">{{ .Title }}</a>
+ </h1>
+
+ <span class="date">
+ <time datetime="{{ .PublishDate }}" title='{{ .PublishDate.Format "Mon, Jan 2, 2006, 3:04 PM MST" }}'>
+ {{ .PublishDate.Format "02/01/2006" }}
+ </time>
+ </span>
+
+ <div class="description">
{{ if .Params.description }}
- {{ .Params.description }}
- {{ else if .Summary }}
- {{ .Summary }}
+ {{ .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
+ </div>
+
+ <div class="mt-2">
+ <a class="read-more" href="{{ .Permalink }}">
+ {{ i18n "readMore" }}
+ <span class="w-4 h-4 stroke-2">
+ {{ partial "utils/icon" "arrow-right" }}
+ </span>
+ </a>
+ </div>
+</article>
diff --git a/layouts/partials/list/pagination.html b/layouts/partials/list/pagination.html
new file mode 100644
index 0000000..2e9487c
--- /dev/null
+++ b/layouts/partials/list/pagination.html
@@ -0,0 +1,23 @@
+{{ $paginator := .Paginator }}
+
+<div class="pb-10 grid grid-cols-2 font-semibold">
+ <!-- Previous page. -->
+ <div>
+ {{ if $paginator.HasPrev }}
+ <a href="{{ $paginator.Prev.URL }}" class="pagination-button">
+ <span class="h-4 w-4 stroke-2"> {{ partial "utils/icon" "arrow-left" }} </span>
+ Newer Posts
+ </a>
+ {{ end }}
+ </div>
+
+ <!-- Next page. -->
+ <div class="flex justify-end">
+ {{ if $paginator.HasNext }}
+ <a href="{{ $paginator.Next.URL }}" class="pagination-button">
+ Older Posts
+ <span class="h-4 w-4 stroke-2"> {{ partial "utils/icon" "arrow-right" }} </span>
+ </a>
+ {{ end }}
+ </div>
+</div>
diff --git a/layouts/partials/single/comments/disqus.html b/layouts/partials/single/comments/disqus.html
new file mode 100644
index 0000000..b794098
--- /dev/null
+++ b/layouts/partials/single/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/comments/giscus.html b/layouts/partials/single/comments/giscus.html
new file mode 100644
index 0000000..00cfec1
--- /dev/null
+++ b/layouts/partials/single/comments/giscus.html
@@ -0,0 +1,22 @@
+<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/comments/index.html b/layouts/partials/single/comments/index.html
new file mode 100644
index 0000000..5a4a1c3
--- /dev/null
+++ b/layouts/partials/single/comments/index.html
@@ -0,0 +1,11 @@
+{{ if .IsPage }}
+ <!-- giscus -->
+ {{ if .Site.Params.giscus.enable }}
+ {{ partial "single/comments/giscus" . }}
+ {{ end }}
+
+ <!-- disqus -->
+ {{ if .Site.Params.disqusShortname }}
+ {{ partial "single/comments/disqus" . }}
+ {{ end }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/single/table-of-contents.html b/layouts/partials/single/table-of-contents.html
new file mode 100644
index 0000000..b8489bc
--- /dev/null
+++ b/layouts/partials/single/table-of-contents.html
@@ -0,0 +1,6 @@
+{{ if and .TableOfContents .Params.tableOfContents }}
+ <aside class="table-of-contents">
+ <h2 class="title-small">{{ i18n "summary" }}</h2>
+ {{ .TableOfContents }}
+ </aside>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/utils/icon.html b/layouts/partials/utils/icon.html
new file mode 100644
index 0000000..7f72418
--- /dev/null
+++ b/layouts/partials/utils/icon.html
@@ -0,0 +1,7 @@
+{{- $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