Templatize lists, tags and single page (#8)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
title: "First Post"
|
||||
date: 2021-05-15T23:39:49+05:30
|
||||
tags: ["abc", "def"]
|
||||
type: post
|
||||
---
|
||||
|
||||
Yo yo yo
|
||||
|
||||
24
exampleSite/content/posts/second_post.md
Normal file
24
exampleSite/content/posts/second_post.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "Second Post"
|
||||
date: 2021-04-15T23:39:49+05:30
|
||||
tags: ["xyz", "def"]
|
||||
type: "post"
|
||||
---
|
||||
|
||||
Yo yo yo
|
||||
|
||||
# This is a heading
|
||||
|
||||
- And
|
||||
- this
|
||||
- is
|
||||
- a
|
||||
- list
|
||||
|
||||
```py
|
||||
Codeblocks look like this
|
||||
|
||||
def print():
|
||||
print('Hello world!')
|
||||
|
||||
```
|
||||
24
exampleSite/content/posts/third_post.md
Normal file
24
exampleSite/content/posts/third_post.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "Third Post"
|
||||
date: 2020-04-15T23:39:49+05:30
|
||||
tags: ["xyz"]
|
||||
type: "post"
|
||||
---
|
||||
|
||||
Yo yo yo
|
||||
|
||||
# This is a heading
|
||||
|
||||
- And
|
||||
- this
|
||||
- is
|
||||
- a
|
||||
- list
|
||||
|
||||
```py
|
||||
Codeblocks look like this
|
||||
|
||||
def print():
|
||||
print('Hello world!')
|
||||
|
||||
```
|
||||
10
exampleSite/content/project/tatooine.md
Normal file
10
exampleSite/content/project/tatooine.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Tatooine"
|
||||
date: 2021-05-12T23:39:49+05:30
|
||||
tags: ["abc", "def"]
|
||||
type: singles
|
||||
---
|
||||
|
||||
### A long time ago in a galaxy far, far away....
|
||||
|
||||
A project was planned
|
||||
13
exampleSite/content/projects.md
Normal file
13
exampleSite/content/projects.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: "Projects"
|
||||
tags: ["abc", "def"]
|
||||
type: singles
|
||||
---
|
||||
|
||||
|
||||
# Hello my projects are
|
||||
|
||||
1. Tatooine: [Link](/project/tatooine/)
|
||||
2. is
|
||||
3. my
|
||||
4. project
|
||||
@@ -6,33 +6,28 @@
|
||||
{{- partial "header.html" . -}}
|
||||
<main id="content">
|
||||
|
||||
<!-- TODO: @yash Paginate this if items more than n -->
|
||||
<div class="container list-posts">
|
||||
|
||||
<h2 class="list-title">All Posts</h2>
|
||||
<h2 class="list-title">{{ .Name }}</h2>
|
||||
|
||||
<h2 class="posts-year">2021</h2>
|
||||
<h4 class="posts-month">March</h4>
|
||||
{{ $posts := where .Data.Pages "Params.type" "post" }}
|
||||
{{ range $posts.GroupByDate "2006" }}
|
||||
|
||||
<h2 class="posts-year">{{ .Key }}</h2>
|
||||
|
||||
<!-- 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="example.com" class="post-link">Theme Documentation - Basics</a>
|
||||
<span class="post-date">March 15, 2021</span>
|
||||
</article>
|
||||
<article class="post-title">
|
||||
<a href="example.com" class="post-link">Theme Documentation - Built-in Shortcodes</a>
|
||||
<span class="post-date">March 15, 2021</span>
|
||||
</article>
|
||||
|
||||
<h2 class="posts-year">2019</h2>
|
||||
<h4 class="posts-month">May</h4>
|
||||
<article class="post-title">
|
||||
<a href="example.com" class="post-link">Basic Markdown Syntax</a>
|
||||
<span class="post-date">May 15, 2019</span>
|
||||
</article>
|
||||
<h4 class="posts-month">January</h4>
|
||||
<article class="post-title">
|
||||
<a href="example.com" class="post-link">Emoji Support</a>
|
||||
<span class="post-date">January 19, 2019</span>
|
||||
<a href="{{ .RelPermalink }}" class="post-link">{{ .Title }}</a>
|
||||
<span class="post-date">{{ dateFormat "January 2, 2006" .Date }}</span>
|
||||
</article>
|
||||
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,27 +6,13 @@
|
||||
{{- partial "header.html" . -}}
|
||||
<main id="content">
|
||||
|
||||
<div class="post container">
|
||||
|
||||
<div class="post-header-section">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<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>
|
||||
{{ if eq .Type "post" }}
|
||||
{{- partial "post.html" . -}}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="post-content">
|
||||
<p>
|
||||
{{ .Content }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{ if eq .Type "singles" }}
|
||||
{{- partial "single.html" . -}}
|
||||
{{ end }}
|
||||
|
||||
</main>
|
||||
{{- partial "footer.html" . -}}
|
||||
|
||||
22
themes/gokarna/layouts/partials/post.html
Normal file
22
themes/gokarna/layouts/partials/post.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<div class="post container">
|
||||
|
||||
<div class="post-header-section">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<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>
|
||||
|
||||
13
themes/gokarna/layouts/partials/single.html
Normal file
13
themes/gokarna/layouts/partials/single.html
Normal 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>
|
||||
|
||||
Reference in New Issue
Block a user