Fix theme switching and templating

This commit is contained in:
Avijit 🚀
2021-06-04 16:43:45 +02:00
committed by Yash Mehrotra
parent f1b6f08dc4
commit f9ee24248e
9 changed files with 125 additions and 135 deletions

View File

@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html class="gokarna-dark">
<html>
{{- partial "head.html" . -}}
<body>
{{- partial "header.html" . -}}
<div id="content">
<main id="content">
{{- block "main" . }}{{- end }}
</div>
</main>
{{- partial "footer.html" . -}}
</body>
</html>

View File

@@ -1,38 +1,26 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
{{ define "main" }}
<!-- TODO: @yash Paginate this if items more than n -->
<div class="container list-posts">
<body>
{{- partial "header.html" . -}}
<main id="content">
<h2 class="list-title">{{ .Name }}</h2>
<!-- TODO: @yash Paginate this if items more than n -->
<div class="container list-posts">
{{ $posts := where .Data.Pages "Params.type" "post" }}
{{ range $posts.GroupByDate "2006" }}
<h2 class="list-title">{{ .Name }}</h2>
<h2 class="posts-year">{{ .Key }}</h2>
{{ $posts := where .Data.Pages "Params.type" "post" }}
{{ range $posts.GroupByDate "2006" }}
<!-- TODO: @yash The month param should be optional -->
{{ range .Pages.GroupByDate "January" }}
<h4 class="posts-month">{{ .Key }}</h4>
{{- range .Pages -}}
<article class="post-title">
<a href="{{ .RelPermalink }}" class="post-link">{{ .Title }}</a>
<span class="post-date">{{ dateFormat "January 2, 2006" .Date }}</span>
</article>
<h2 class="posts-year">{{ .Key }}</h2>
{{ end }}
{{ end }}
{{ end }}
<!-- TODO: @yash The month param should be optional -->
{{ range .Pages.GroupByDate "January" }}
<h4 class="posts-month">{{ .Key }}</h4>
{{- range .Pages -}}
<article class="post-title">
<a href="{{ .RelPermalink }}" class="post-link">{{ .Title }}</a>
<span class="post-date">{{ dateFormat "January 2, 2006" .Date }}</span>
</article>
{{ end }}
{{ end }}
{{ end }}
</div>
</main>
{{- partial "footer.html" . -}}
</body>
</html>
</div>
{{ end }}

View File

@@ -1,21 +1,9 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
{{ define "main" }}
{{ if eq .Type "post" }}
{{- partial "post.html" . -}}
{{ end }}
<body>
{{- partial "header.html" . -}}
<main id="content">
{{ if eq .Type "post" }}
{{- partial "post.html" . -}}
{{ end }}
{{ if eq .Type "singles" }}
{{- partial "single.html" . -}}
{{ end }}
</main>
{{- partial "footer.html" . -}}
</body>
</html>
{{ if eq .Type "singles" }}
{{- partial "single.html" . -}}
{{ end }}
{{ end }}

View File

@@ -1,29 +1,17 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
{{ define "main" }}
<div class="container tags-list">
<body>
{{- partial "header.html" . -}}
<main id="content">
<h2 class="list-title">Tags</h2>
<ul class="post-tags">
{{ range $key, $value := .Data.Terms.ByCount }}
<li class="post-tag">
<a href="/tags/{{ $value.Name | urlize }}/">
<div class="tag-name">{{ $value.Name }}</div>
<div class="tag-posts-count">{{ $value.Count }}</div>
</a>
</li>
{{ end }}
</ul>
<div class="container tags-list">
<h2 class="list-title">Tags</h2>
<ul class="post-tags">
{{ range $key, $value := .Data.Terms.ByCount }}
<li class="post-tag">
<a href="/tags/{{ $value.Name | urlize }}/">
<div class="tag-name">{{ $value.Name }}</div>
<div class="tag-posts-count">{{ $value.Count }}</div>
</a>
</li>
{{ end }}
</ul>
</div>
</main>
{{- partial "footer.html" . -}}
</body>
</html>
</div>
{{ end }}

View File

@@ -2,11 +2,11 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
<link async rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
integrity="sha512-NhSC1YmyruXifcj/KFRWoC561YpHpc5Jtzgvbuzx5VozKpWvQ+4nXhPdFgmx8xqexRcpAglTj9sIBWINXa8x5w=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" type="text/css" href="/css/main.css">
<script src="/js/jquery-3.6.0.slim.min.js"></script>
<link disabled id="dark-theme" rel="stylesheet" href="/css/dark.css">
<script src="/js/main.js"></script>
{{ $title := print .Site.Title " | " .Title }}
{{ if .IsHome }}{{ $title = .Site.Title }}{{ end }}

View File

@@ -1,4 +1,4 @@
<header class="header gokarna-dark">
<header class="header">
<nav class="header-nav">
<div class="avatar">
@@ -33,7 +33,7 @@
</div>
-->
<span class="nav-icons-divider"></span>
<div class="nav-link" id="dark-light-theme-toggle">
<div class="nav-link" id="dark-theme-toggle">
<a>
<span class="fa fa-moon-o"></span>
</a>