post section and taxonomy
This commit is contained in:
@@ -44,5 +44,5 @@ custom_css = []
|
||||
- [x] Set up homepage template
|
||||
- [x] Post summry template
|
||||
- [ ] Complete readme
|
||||
- [ ] Add list page template to post section
|
||||
- [ ] Add taxonomy templates
|
||||
- [x] Add list page template to post section
|
||||
- [x] Add taxonomy templates
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
{{ $baseUrl := .Site.BaseURL }}
|
||||
|
||||
{{ if isset .Params "topics" }}
|
||||
{{ $count := len .Params.topics }}
|
||||
{{ if isset .Params "categories" }}
|
||||
{{ $count := len .Params.categories }}
|
||||
{{ if gt $count 0 }}
|
||||
<div>
|
||||
<i class="fa fa-folder fa-fw"></i>
|
||||
{{ range $k, $v := .Params.topics }}
|
||||
<a class="post-taxonomy-topic" href="{{ $baseUrl }}topics/{{ . | urlize }}">{{ . }}</a>{{ if lt $k (sub $count 1) }} /{{ end }}
|
||||
{{ range $k, $v := .Params.categories }}
|
||||
<a class="post-taxonomy-category" href="{{ $baseUrl }}categories/{{ . | urlize }}">{{ . }}</a>{{ if lt $k (sub $count 1) }} /{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
14
layouts/partials/prev-next-post.html
Normal file
14
layouts/partials/prev-next-post.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{ if or (.PrevInSection) (.NextInSection) }}
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
{{ if .PrevInSection }}
|
||||
<a href="{{ .PrevInSection.Permalink }}"><i class="fa fa-chevron-left fa-fw"></i>{{ .PrevInSection.Title }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
{{ if .NextInSection }}
|
||||
<a href="{{ .NextInSection.Permalink }}">{{ .NextInSection.Title }}<i class="fa fa-chevron-right fa-fw"></i></a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
14
layouts/post/list.html
Normal file
14
layouts/post/list.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{ define "main" }}
|
||||
<div class="header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<h2>{{ .Site.Params.subtitle }}</h2>
|
||||
</div>
|
||||
<div class="content">
|
||||
{{ $paginator := .Paginate ( where .Data.Pages "Type" "post") }}
|
||||
{{ range $paginator.Pages }}
|
||||
{{ .Render "summary" }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
17
layouts/post/single.html
Normal file
17
layouts/post/single.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{ define "main" }}
|
||||
<div class="header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<h2>{{ .Description }}</h2>
|
||||
</div>
|
||||
<div class="content">
|
||||
|
||||
{{ partial "post-meta.html" . }}
|
||||
|
||||
{{ .Content }}
|
||||
|
||||
{{ partial "prev-next-post.html" . }}
|
||||
|
||||
{{ partial "disqus.html" . }}
|
||||
|
||||
</div>
|
||||
{{ end }}
|
||||
13
layouts/taxonomy/list.html
Normal file
13
layouts/taxonomy/list.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{{ define "main" }}
|
||||
<div class="header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
{{ $paginator := .Paginate ( where .Data.Pages "Type" "post") }}
|
||||
{{ range $paginator.Pages }}
|
||||
{{ .Render "summary" }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
16
layouts/taxonomy/terms.html
Normal file
16
layouts/taxonomy/terms.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ define "main" }}
|
||||
<div class="header">
|
||||
<h1>{{ .Title }}</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<ul>
|
||||
{{ $data := .Data }}
|
||||
{{ range $key, $value := .Data.Terms.ByCount }}
|
||||
<li>
|
||||
<a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ urlize $value.Name }}">{{ $value.Name }}</a>
|
||||
<span>({{ $value.Count }})</span>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user