diff options
author | Shubham Saini <me@ubh.sh> | 2023-02-09 00:19:28 +0000 |
---|---|---|
committer | Shubham Saini <me@ubh.sh> | 2023-02-09 00:19:28 +0000 |
commit | d7da16ecfa5cadb643df78694db44963ba665cbe (patch) | |
tree | 00c5234f542f7064e91827064767bcf59f094a2c /layouts |
init
Diffstat (limited to 'layouts')
-rwxr-xr-x | layouts/404.html | 14 | ||||
-rwxr-xr-x | layouts/_default/baseof.html | 11 | ||||
-rwxr-xr-x | layouts/_default/list.html | 17 | ||||
-rwxr-xr-x | layouts/_default/single.html | 33 | ||||
-rwxr-xr-x | layouts/_default/term.html | 15 | ||||
-rwxr-xr-x | layouts/_default/terms.html | 20 | ||||
-rwxr-xr-x | layouts/index.html | 37 | ||||
-rwxr-xr-x | layouts/partials/footer.html | 11 | ||||
-rwxr-xr-x | layouts/partials/head.html | 11 | ||||
-rwxr-xr-x | layouts/partials/header.html | 22 | ||||
-rwxr-xr-x | layouts/partials/paginator.html | 15 |
11 files changed, 206 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html new file mode 100755 index 0000000..70e40c1 --- /dev/null +++ b/layouts/404.html | |||
@@ -0,0 +1,14 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html> | ||
3 | {{ partial "header.html" . }} | ||
4 | <body> | ||
5 | <div class="content"> | ||
6 | {{ partial "head.html" . }} | ||
7 | <p align="center"> | ||
8 | <b>404</b> │ Nothing here | ||
9 | </p> | ||
10 | {{ partial "footer.html" . }} | ||
11 | </div> | ||
12 | </body> | ||
13 | </html> | ||
14 | |||
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100755 index 0000000..b941097 --- /dev/null +++ b/layouts/_default/baseof.html | |||
@@ -0,0 +1,11 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html> | ||
3 | {{- partial "header.html" . -}} | ||
4 | <body> | ||
5 | <div class="content"> | ||
6 | {{- partial "head.html" . -}} | ||
7 | {{- block "main" . }}{{- end }} | ||
8 | {{- partial "footer.html" . -}} | ||
9 | </div> | ||
10 | </body> | ||
11 | </html> | ||
diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100755 index 0000000..41a4c6f --- /dev/null +++ b/layouts/_default/list.html | |||
@@ -0,0 +1,17 @@ | |||
1 | {{ define "main" }} | ||
2 | {{ if isset .Data "Term" }} | ||
3 | <h1>Entries tagged - "{{ .Data.Term }}"</h1> | ||
4 | {{ else }} | ||
5 | <h1 class="page-title">All articles</h1> | ||
6 | {{ end }} | ||
7 | |||
8 | <ul class="posts"> | ||
9 | {{- range .Data.Pages -}} | ||
10 | {{- if (not (in (.Site.Params.excludedTypes | default (slice "page")) .Type)) -}} | ||
11 | <li class="post"> | ||
12 | <a href="{{ .RelPermalink }}">{{.Title}}</a> <span class="meta">{{ dateFormat "Jan 2, 2006" .Date }}{{ if .Draft }} <span class="draft-label">DRAFT</span> {{ end }}</span> | ||
13 | </li> | ||
14 | {{- end -}} | ||
15 | {{- end -}} | ||
16 | </ul> | ||
17 | {{ end }} | ||
diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100755 index 0000000..44222d4 --- /dev/null +++ b/layouts/_default/single.html | |||
@@ -0,0 +1,33 @@ | |||
1 | {{ define "main" }} | ||
2 | <main> | ||
3 | <article> | ||
4 | <div class="title"> | ||
5 | <h1 class="title">{{ .Title }}</h1> | ||
6 | {{ if .Date }}<div class="meta">Posted on {{ dateFormat "Jan 2, 2006" .Date }}{{ if .Draft }} <span class="draft-label">DRAFT</span> {{ end }}</div> {{ end }} | ||
7 | </div> | ||
8 | {{ if isset .Params "tldr" }} | ||
9 | <div class="tldr"> | ||
10 | <strong>tl;dr:</strong> | ||
11 | {{ .Params.tldr }} | ||
12 | </div>{{ end }} | ||
13 | |||
14 | <section class="body"> | ||
15 | {{ .Content }} | ||
16 | </section> | ||
17 | |||
18 | <div class="post-tags"> | ||
19 | {{ if ne .Type "page" }} | ||
20 | {{ if gt .Params.tags 0 }} | ||
21 | <nav class="nav tags"> | ||
22 | <ul class="tags"> | ||
23 | {{ range .Params.tags }} | ||
24 | <li><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></li> | ||
25 | {{ end }} | ||
26 | </ul> | ||
27 | </nav> | ||
28 | {{ end }} | ||
29 | {{ end }} | ||
30 | </div> | ||
31 | </article> | ||
32 | </main> | ||
33 | {{ end }} | ||
diff --git a/layouts/_default/term.html b/layouts/_default/term.html new file mode 100755 index 0000000..9648bf3 --- /dev/null +++ b/layouts/_default/term.html | |||
@@ -0,0 +1,15 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html> | ||
3 | {{ partial "header.html" . }} | ||
4 | |||
5 | <body> | ||
6 | <div class="container wrapper tags"> | ||
7 | {{ partial "head.html" . }} | ||
8 | |||
9 | <h1 class="page-title">All tags</h1> | ||
10 | </div> | ||
11 | |||
12 | {{ partial "footer.html" . }} | ||
13 | </body> | ||
14 | |||
15 | </html> \ No newline at end of file | ||
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100755 index 0000000..fea9c2f --- /dev/null +++ b/layouts/_default/terms.html | |||
@@ -0,0 +1,20 @@ | |||
1 | {{ define "main" }} | ||
2 | <h1 class="page-title">All tags</h1> | ||
3 | |||
4 | {{ $biggest := 1 }} | ||
5 | {{ $smallest := 1 }} | ||
6 | {{ $max := 3 }} | ||
7 | {{ $min := 1 }} | ||
8 | {{ $size := $min }} | ||
9 | |||
10 | {{ $data := .Data }} | ||
11 | <div class="tag-cloud"> | ||
12 | <ul class="tags"> | ||
13 | {{ range $key, $value := .Data.Terms.ByCount }} | ||
14 | {{ $size := (add (mul (div $value.Count $biggest) (sub $max $min)) $min) }} | ||
15 | {{ $size := (cond (eq $biggest $smallest) $min $size) }} | ||
16 | <li><a style="font-size: {{ $size }}rem;" href="{{ $.Site.LanguagePrefix | absURL }}{{ $data.Plural }}/{{ $value.Name | urlize }}/">{{ $value.Name }}</a></li> | ||
17 | {{ end }} | ||
18 | </ul> | ||
19 | </div> | ||
20 | {{ end }} | ||
diff --git a/layouts/index.html b/layouts/index.html new file mode 100755 index 0000000..43a3508 --- /dev/null +++ b/layouts/index.html | |||
@@ -0,0 +1,37 @@ | |||
1 | <html lang="en"> | ||
2 | {{ partial "header.html" . }} | ||
3 | <body> | ||
4 | <div class="content"> | ||
5 | {{ partial "head.html" . }} | ||
6 | <main class="list"> | ||
7 | <div class="site-description"> | ||
8 | {{- if isset .Site.Params "subtitle" -}} | ||
9 | <p>{{ .Site.Params.Subtitle | markdownify }}</p> | ||
10 | {{- end -}} | ||
11 | </div> | ||
12 | {{- if isset .Site.Params "note" -}} | ||
13 | {{ .Site.Params.Note | markdownify }} | ||
14 | {{- end -}} | ||
15 | |||
16 | {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} | ||
17 | {{ $paginator := .Paginate (where $pages "Params.hidden" "ne" true) }} | ||
18 | {{ range $paginator.Pages }} | ||
19 | <section class="list-item"> | ||
20 | <h1 class="title"><a href="{{ .RelPermalink }}">{{.Title}}</a></h1> | ||
21 | <time>{{ dateFormat "Jan 2, 2006" .Date }}{{ if .Draft }} <span class="draft-label">DRAFT</span> {{ end }}</time> | ||
22 | <br><div class="description"> | ||
23 | {{ if isset .Params "description" }} | ||
24 | {{ .Description }} | ||
25 | {{ else }} | ||
26 | {{ .Summary }}… | ||
27 | {{ end }} | ||
28 | </div> | ||
29 | <a href="{{ .RelPermalink }}">Read more ⟶</a> | ||
30 | </section> | ||
31 | {{ end }} | ||
32 | {{ template "partials/paginator.html" . }} | ||
33 | </main> | ||
34 | {{ partial "footer.html" . }} | ||
35 | </div> | ||
36 | </body> | ||
37 | </html> | ||
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100755 index 0000000..9f04da6 --- /dev/null +++ b/layouts/partials/footer.html | |||
@@ -0,0 +1,11 @@ | |||
1 | <hr> | ||
2 | <footer> | ||
3 | <div class="main"> | ||
4 | {{- if isset .Site.Params "copyright" -}} | ||
5 | {{ .Site.Params.Copyright | markdownify }} | ||
6 | {{- end -}} | ||
7 | </div> | ||
8 | <nav> | ||
9 | <a class="footings" rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img class="footings" alt="Creative Commons License" src="https://licensebuttons.net/l/by-nc-sa/4.0/80x15.png" /></a> | ||
10 | </nav> | ||
11 | </footer> | ||
diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100755 index 0000000..3c9693b --- /dev/null +++ b/layouts/partials/head.html | |||
@@ -0,0 +1,11 @@ | |||
1 | <header> | ||
2 | <div class="main"> | ||
3 | <a href="/"> | ||
4 | <div class="logo" style="background-image: url('/images/logo.png');"></div> | ||
5 | </div> | ||
6 | <nav> | ||
7 | {{ range .Site.Menus.main }} | ||
8 | <a href="{{ .URL }}">{{ .Name }}</a> | ||
9 | {{ end }} | ||
10 | </nav> | ||
11 | </header> | ||
diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100755 index 0000000..548acb1 --- /dev/null +++ b/layouts/partials/header.html | |||
@@ -0,0 +1,22 @@ | |||
1 | <head> | ||
2 | <meta charset="utf-8" /> | ||
3 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
4 | {{- $title := ( .Title ) -}} | ||
5 | {{- $siteTitle := ( .Site.Title ) -}} | ||
6 | {{- if .IsHome -}} | ||
7 | <title>{{ $siteTitle }}</title> | ||
8 | {{- else -}} | ||
9 | <title>{{ $title }}</title> | ||
10 | {{- end -}} | ||
11 | {{- if isset .Site.Params "favicon" -}} | ||
12 | <link rel="icon" type="image/png" href={{ .Site.Params.favicon }} /> | ||
13 | {{- end -}} | ||
14 | <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
15 | {{ with .OutputFormats.Get "rss" -}} | ||
16 | {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} | ||
17 | {{ end -}} | ||
18 | <link rel="stylesheet" type="text/css" media="screen" href="/css/main.css" /> | ||
19 | {{- if or (eq .Site.Params.mode "auto") (eq .Site.Params.mode "dark") -}} | ||
20 | <link rel="stylesheet" type="text/css" href="/css/dark.css" {{ if eq .Site.Params.mode "auto" }}media="(prefers-color-scheme: dark)"{{ end }} /> | ||
21 | {{- end -}} | ||
22 | </head> | ||
diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html new file mode 100755 index 0000000..5acc06d --- /dev/null +++ b/layouts/partials/paginator.html | |||
@@ -0,0 +1,15 @@ | |||
1 | {{ $pag := $.Paginator }} | ||
2 | {{ if gt $pag.TotalPages 1 }} | ||
3 | <ul class="pagination"> | ||
4 | <span class="page-item page-prev"> | ||
5 | {{ if $pag.HasPrev }} | ||
6 | <a {{ if $pag.HasPrev }}href="{{ $pag.Prev.URL }}"{{ end }} class="page-link" aria-label="Previous"><span aria-hidden="true">← Prev</span></a> | ||
7 | {{ end }} | ||
8 | </span> | ||
9 | <span class="page-item page-next"> | ||
10 | {{ if $pag.HasNext }} | ||
11 | <a {{ if $pag.HasNext }}href="{{ $pag.Next.URL }}"{{ end }} class="page-link" aria-label="Next"><span aria-hidden="true">Next →</span></a> | ||
12 | {{ end }} | ||
13 | </span> | ||
14 | </ul> | ||
15 | {{ end }} | ||