summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-27 01:36:12 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-08-27 01:36:12 +0530
commit77d4a98a666ef6c2c18c10f2f2d62210f9eeb752 (patch)
tree11c75334b682009ff015a0fcd2e8eddc7eb4d315 /layouts
first commit
Diffstat (limited to 'layouts')
-rw-r--r--layouts/404.html0
-rw-r--r--layouts/_default/baseof.html16
-rw-r--r--layouts/_default/list.html13
-rw-r--r--layouts/_default/single.html3
-rw-r--r--layouts/blog/list.html19
-rw-r--r--layouts/blog/single.html27
-rw-r--r--layouts/index.html24
-rw-r--r--layouts/partials/blog-list.html16
-rw-r--r--layouts/partials/blog-section-list.html8
-rw-r--r--layouts/partials/footer.html5
-rw-r--r--layouts/partials/head.html30
-rw-r--r--layouts/partials/header.html10
12 files changed, 171 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layouts/404.html
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
new file mode 100644
index 0000000..9bc0b22
--- /dev/null
+++ b/layouts/_default/baseof.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+ {{- partial "head.html" . -}}
+ <body>
+ {{ if ne .Kind "home" }}
+ <!-- don't show header on index.html -->
+ {{- partial "header.html" . -}}
+ {{ end }}
+
+ <main id="site-{{ if eq .Kind "home" }}home{{ else }}{{ .Section }}{{ end }}-page">
+ {{- 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..5ecbbe0
--- /dev/null
+++ b/layouts/_default/list.html
@@ -0,0 +1,13 @@
+{{ define "main" }}
+ <div id="{{.Section}}-list">
+ <h1>{{ if .Params.heading }}{{ .Params.heading }}{{ else }}{{ .Title }}{{ end }}</h1>
+
+ {{ .Content }}
+
+ {{ range (union .Sections .Pages).ByDate.Reverse }}
+ <p>
+ <a href="{{ .RelPermalink }}">{{ .Title }}</a>
+ </p>
+ {{ end }}
+ </div>
+{{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
new file mode 100644
index 0000000..e0e8308
--- /dev/null
+++ b/layouts/_default/single.html
@@ -0,0 +1,3 @@
+{{ define "main" }}
+ {{ .Content }}
+{{ end }}
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
new file mode 100644
index 0000000..9040dea
--- /dev/null
+++ b/layouts/blog/list.html
@@ -0,0 +1,19 @@
+{{ define "main" }}
+ <div id="blog-list">
+ <h1>
+ {{ if .Params.heading }}
+ {{ .Params.heading }}
+ {{ else }}
+ {{ .Title }}
+ {{ end }}
+ </h1>
+
+ {{ .Content }}
+
+ {{ if .Sections }}
+ {{- partial "blog-section-list.html" . -}}
+ {{ else }}
+ {{- partial "blog-list.html" . -}}
+ {{ end }}
+ </div>
+{{ end }}
diff --git a/layouts/blog/single.html b/layouts/blog/single.html
new file mode 100644
index 0000000..035db0a
--- /dev/null
+++ b/layouts/blog/single.html
@@ -0,0 +1,27 @@
+{{ define "main" }}
+ <article id="blog-post">
+ <header>
+ <h1>{{ .Title }}</h1>
+
+ <div id="blog-post-details">
+ <span id="date">
+ Published on
+ {{ .Date.Format "2" }}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }}
+ {{ .Date.Format "January" }}
+ {{ .Date.Format "2006" }}
+ </span>
+
+ <span id="reading-time">
+ Approx
+ {{ .ReadingTime }}
+ minute{{ if (ne .ReadingTime 1) }}s{{ end }}
+ read
+ </span>
+ </div>
+
+ <hr>
+ </header>
+
+ {{ .Content }}
+ </article>
+{{ end }}
diff --git a/layouts/index.html b/layouts/index.html
new file mode 100644
index 0000000..46e5188
--- /dev/null
+++ b/layouts/index.html
@@ -0,0 +1,24 @@
+{{ define "main" }}
+<div id="home-wrapper">
+ <div id="home">
+ <div id="nav-wrapper">
+ <div id="my-image-wrapper">
+ <img id="my-image" src="{{ .Params.img }}" alt="{{ .Params.alt }}">
+ </div>
+
+ <div id="title-nav">
+ <h1>{{ .Params.navTitle }}</h1>
+ <nav>
+ {{ range .Site.Params.homepageLinks }}
+ <a href="{{ index . 1 }}">{{ index . 0 }}</a>
+ {{ end }}
+ </nav>
+ </div>
+ </div>
+
+ <div id="content">
+ {{ .Content }}
+ </div>
+ </div>
+</div>
+{{ end }}
diff --git a/layouts/partials/blog-list.html b/layouts/partials/blog-list.html
new file mode 100644
index 0000000..c05eb84
--- /dev/null
+++ b/layouts/partials/blog-list.html
@@ -0,0 +1,16 @@
+{{ range (union .Sections .Pages).ByDate.Reverse }}
+ <div class="blog-post-wrapper">
+ <a class="blog-post-anchor" href="{{ .RelPermalink }}">
+ <div class="blog-post">
+ <span class="date">
+ {{/* .Date.Format "2" }}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }} {{ .Date.Format "January" */}}
+ {{ .Date.Format "02" }} {{ .Date.Format "Jan" }}
+ </span>
+
+ <span class="title">
+ {{ .Title }}
+ </span>
+ </div>
+ </a>
+ </div>
+{{ end }}
diff --git a/layouts/partials/blog-section-list.html b/layouts/partials/blog-section-list.html
new file mode 100644
index 0000000..b475f27
--- /dev/null
+++ b/layouts/partials/blog-section-list.html
@@ -0,0 +1,8 @@
+{{ range .Sections.ByDate.Reverse }}
+ <div class="blog-section-wrapper">
+ <a href="{{ .RelPermalink }}">
+ <h2 class="blog-section" id="{{ .Title }}">{{ .Title }}</h2>
+ </a>
+ {{- partial "blog-list.html" . -}}
+ </div>
+{{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
new file mode 100644
index 0000000..63ba377
--- /dev/null
+++ b/layouts/partials/footer.html
@@ -0,0 +1,5 @@
+<footer>
+ <div id="copyright">
+ {{ .Site.Copyright | safeHTML }}
+ </div>
+</footer>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
new file mode 100644
index 0000000..9cf7575
--- /dev/null
+++ b/layouts/partials/head.html
@@ -0,0 +1,30 @@
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta name="author" content={{ .Site.Author.name }}>
+
+ <meta name="robots" content="index,follow">
+ <meta name="description" content="{{ .Title }}">
+
+ <meta property="og:type" content="website">
+ <meta property="og:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}">
+ <meta property="og:site_name" content="{{ .Site.Title }}">
+ <meta property="og:image" content="{{ .Site.Params.ogImage }}">
+ <meta property="og:url" content="{{ .Permalink }}">
+
+ <link rel="stylesheet" type="text/css" href="/css/styles.css">
+
+ {{ if eq .Section "blog" }}
+ <link rel="stylesheet" type="text/css" href="/css/blog.css">
+ {{ else }}
+ <link rel="stylesheet" type="text/css" href="/css/home.css">
+ {{ end }}
+
+ <title>
+ {{ if .Title }}
+ {{ .Title }}
+ {{ else }}
+ {{ .Site.Title }}
+ {{ end }}
+ </title>
+</head>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644
index 0000000..ba1869b
--- /dev/null
+++ b/layouts/partials/header.html
@@ -0,0 +1,10 @@
+<div id="site-header">
+ <nav id="global-nav">
+ {{ range .Site.Params.navLinks }}
+ {{ $path := index . 1 }}
+ <a href="{{ $path }}" {{ if $.Params.navPath }}{{ $p := printf "/%s" $.Params.navPath | printf "%s" }}{{ if eq $path $p }}id="nav-link-active"{{ end }}{{ else }}{{ $p := printf "/%s" $.Section | printf "%s" }}{{ if eq $path $p }}id="nav-link-active"{{ end }}{{ end }}>
+ {{ index . 0 }}
+ </a>
+ {{ end }}
+ </nav>
+</div>