Rearchitect theme directory (#59)

* Rearchitect theme directory

* Fix symlink
This commit is contained in:
Yash Mehrotra
2021-08-14 02:41:02 +05:30
committed by GitHub
parent 8aa9fc4061
commit e8b9e86fc5
25 changed files with 1 additions and 21 deletions

19
layouts/404.html Normal file
View File

@@ -0,0 +1,19 @@
{{ define "main"}}
<div class="text-404">
<h1 class="error-emoji"></h1>
<h2>
404 ... This page does not exist, go <a href="{{ "/" | relURL }}">home</a>
</h2>
</div>
<script>
const errorEmojiContainer = document.getElementsByClassName('error-emoji')[0];
const emojiArray = [
'\\(o_o)/', '(o^^)o', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)',
'(=\'X\'=)', '(>_<)', '(;-;)', '\\(^Д^)/',
];
const errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)];
errorEmojiContainer.appendChild(document.createTextNode(errorEmoji));
</script>
{{ end }}

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
{{- partial "head.html" . -}}
<body>
<script type="text/javascript">
// Immediately set theme on page load
setThemeByUserPref();
</script>
{{- partial "header.html" . -}}
<main id="content">
{{- block "main" . }}{{- end }}
</main>
{{- partial "footer.html" . -}}
</body>
</html>

View File

@@ -0,0 +1,7 @@
{{ define "main" }}
{{ if eq .Type "page" }}
{{- partial "page.html" . -}}
{{ else }}
{{- partial "list.html" . -}}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,9 @@
{{ define "main" }}
{{ if eq .Type "post" }}
{{- partial "post.html" . -}}
{{ end }}
{{ if eq .Type "page" }}
{{- partial "page.html" . -}}
{{ end }}
{{ end }}

View File

@@ -0,0 +1,17 @@
{{ define "main" }}
<div class="container tags-list">
<h1 class="list-title">Tags</h1>
<ul class="post-tags">
{{ range $.Site.Taxonomies.tags.ByCount }}
<li class="post-tag">
<a href="/tags/{{ .Name | urlize }}/">
<div class="tag-name">{{ .Name }}</div>
<div class="tag-posts-count">{{ .Count }}</div>
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}

34
layouts/index.html Normal file
View File

@@ -0,0 +1,34 @@
{{ define "main" }}
<section class="home-about">
<div class="avatar">
{{ if isset .Site.Params "avatarurl" }}
<img class={{ .Site.Params.AvatarSize | default "size-m" }} src='{{ .Site.Params.AvatarURL }}'>
{{ end }}
</div>
<h1>{{ .Site.Title }}</h1>
<h3>{{ .Site.Params.Description }}</h3>
</section>
<div class="flex-break"></div>
{{ if isset .Site.Params "showpostsonhomepage" }}
<div class="home-posts list-posts">
<h2>{{ .Site.Params.ShowPostsOnHomePage | humanize }} Posts</h2>
{{ $posts := where .Site.Pages "Params.type" "post" }}
{{ if eq .Site.Params.ShowPostsOnHomePage "popular" }}
{{ range $posts.ByWeight | first 4 }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ else if eq .Site.Params.ShowPostsOnHomePage "recent" }}
{{ range $posts.ByDate.Reverse | first 4 }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,6 @@
<footer class="footer">
<span>&copy; {{ now.Year }} {{ .Site.Params.Footer}}</span>
<span>
Made with &#10084;&#65039; using <a target="_blank" href="https://github.com/526avijitgupta/gokarna">Gokarna</a>
</span>
</footer>

View File

@@ -0,0 +1,50 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
:root {
--accent-color: {{ .Site.Params.AccentColor | default "#FF4D4D" }};
}
</style>
{{ $title := .Title | default .Site.Title }}
{{ $description := .Description | default .Site.Params.Description }}
{{ $image := .Params.image | default .Site.Params.AvatarURL }}
{{ $siteKeywords := .Site.Params.MetaKeywords | default (slice) }}
{{ $postKeywords := .Params.tags | default (slice) }}
{{ $keywords := union $siteKeywords $postKeywords }}
<!-- SEO titles & descriptions -->
<title>{{ $title }}</title>
<meta name="description" content="{{ $description }}">
<meta name="keywords" content='{{ delimit $keywords ", "}}'>
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:type" content="website">
<meta property="og:title" content="{{ $title }}">
<meta property="og:description" content="{{ $description }}">
<meta property="og:image" content="{{ $image }}">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ $title }}">
<meta name="twitter:description" content="{{ $description }}">
<meta property="twitter:domain" content="{{ .Permalink }}">
<meta property="twitter:url" content="{{ .Permalink }}">
<meta name="twitter:image" content="{{ $image }}">
<!-- SEO canonicals: helps Google understand your site better when using marketing campaign tagging etc -->
<link rel="canonical" href="{{ .Permalink }}" />
<link rel="stylesheet" type="text/css" href="/css/normalize.min.css" media="print" onload="this.media='all'">
<link rel="stylesheet" type="text/css" href="/css/main.css">
<link disabled id="dark-theme" rel="stylesheet" href="/css/dark.css">
<script src="/js/feather-icons.min.js"></script>
<script src="/js/main.js"></script>
<!-- Option for user to inject custom html -->
{{ if .Site.Params.CustomHeadHTML }}
{{ .Site.Params.CustomHeadHTML | safeHTML }}
{{ end }}
</head>

View File

@@ -0,0 +1,56 @@
<header class="header">
<nav class="header-nav">
{{ if isset .Site.Params "avatarurl" }}
<div class="avatar">
<a href="{{ .Site.BaseURL }}">
<img src="{{ .Site.Params.AvatarURL }}" alt="avatar" />
</a>
</div>
{{ end }}
<div class="nav-title">
<a class="nav-brand" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</div>
<div class="nav-links">
{{ range .Site.Menus.main }}
<div class="nav-link">
<a href="{{ .URL }}">
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
</a>
</div>
{{ end }}
<span class="nav-icons-divider"></span>
<div class="nav-link dark-theme-toggle">
<a>
<span id="theme-toggle-icon" data-feather="moon"></span>
</a>
</div>
<div class="nav-link" id="hamburger-menu-toggle">
<a>
<span data-feather="menu"></span>
</a>
</div>
<!-- For mobile -->
<ul class="nav-hamburger-list visibility-hidden">
{{ range .Site.Menus.main }}
<li class="nav-item">
<a href="{{ .URL }}">
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
</a>
</li>
{{ end }}
<li class="nav-item dark-theme-toggle">
<a>
<span id="theme-toggle-icon" data-feather="moon"></span>
</a>
</li>
</ul>
</div>
</nav>
</header>

View File

@@ -0,0 +1,5 @@
<article class="post-title">
<a href="{{ .RelPermalink }}" class="post-link">{{ .Title }}</a>
<div class="flex-break"></div>
<span class="post-date">{{ dateFormat "January 2, 2006" .Date }}</span>
</article>

View File

@@ -0,0 +1,14 @@
<div class="container list-posts">
<h1 class="list-title">{{ .Name }}</h2>
{{ range (where .Pages "Params.type" "post" ).GroupByDate "2006" }}
<h2 class="posts-year">{{ .Key }}</h2>
{{- range .Pages -}}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ end }}
</div>

View File

@@ -0,0 +1,13 @@
<div class="post container">
<div class="post-header-section">
<h1>{{ .Title }}</h1>
</div>
<div class="post-content">
<p>
{{ .Content }}
</p>
</div>
</div>

View File

@@ -0,0 +1,23 @@
<div class="post container">
<div class="post-header-section">
<h1>{{ .Title }}</h1>
<small role="doc-subtitle">{{ .Description }}</small>
<p class="post-date">
{{ dateFormat "January 2, 2006" .Date }}
</p>
<ul class="post-tags">
{{ range .Params.tags }}
<li class="post-tag"><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></li>
{{ end }}
</ul>
</div>
<div class="post-content">
<p>
{{ .Content }}
</p>
</div>
</div>