Templatize lists, tags and single page (#8)
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -40,4 +35,4 @@
|
||||
{{- partial "footer.html" . -}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -6,27 +6,13 @@
|
||||
{{- partial "header.html" . -}}
|
||||
<main id="content">
|
||||
|
||||
<div class="post container">
|
||||
{{ if eq .Type "post" }}
|
||||
{{- partial "post.html" . -}}
|
||||
{{ end }}
|
||||
|
||||
<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>
|
||||
{{ 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