mirror of
https://github.com/ItsDrike/itsdrike.com.git
synced 2024-11-10 05:59:41 +00:00
Add partials
This commit is contained in:
parent
16103599b3
commit
9f753226f6
|
@ -4,12 +4,21 @@
|
||||||
<title>{{.Title}}</title>
|
<title>{{.Title}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>{{.Title}}</h1>
|
{{ partial "content.html" . }}
|
||||||
{{.Content}}
|
|
||||||
{{ range .Pages }}
|
<!--Group posts by months-->
|
||||||
<ul>
|
{{ range .Pages.GroupByDate "2006-01" }}
|
||||||
<li><a href="{{.Permalink}}">{{.Title}}</a></li>
|
{{ $month := print .Key "-01"}}
|
||||||
</ul>
|
{{ $display := dateFormat "2006-01" $month }}
|
||||||
|
<h3 id="{{ $display }}">
|
||||||
|
<a href="#{{ $display }}">
|
||||||
|
<time datetime="{{ $month }}" title='{{ dateFormat "January 2006" $month }}'>{{ $display }}</time>
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
<!--List posts belonging to current month -->
|
||||||
|
{{ range (sort .Pages "Date" "desc") }}
|
||||||
|
{{ partial "list_item.html" . }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
<title>{{.Title}}</title>
|
<title>{{.Title}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>{{.Title}}</h1>
|
{{ partial "content.html" . }}
|
||||||
<h4>{{.Date}}</h4>
|
|
||||||
<br>
|
|
||||||
{{.Content}}
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
9
layouts/partials/content-details.html
Normal file
9
layouts/partials/content-details.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{{ if not .Date.IsZero }}
|
||||||
|
<span title='{{ .Date.Format "January 2 2006" }}'>{{ .Date.Format "2006-01-02" }}</span>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if .Params.tags }}
|
||||||
|
{{ range $1, $e := .Params.tags }}
|
||||||
|
<a href="/tags/{{ urlize . }}">#{{ . }}</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
14
layouts/partials/content.html
Normal file
14
layouts/partials/content.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<h1>{{ .Title }}</h1>
|
||||||
|
{{ if .IsPage }}
|
||||||
|
<p>{{ partial "content-details.html" . }}</p>
|
||||||
|
{{ end }}
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{{ if .TableOfContents }}
|
||||||
|
<div class="content">
|
||||||
|
{{ .TableOfContents }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ .Content }}
|
||||||
|
</div>
|
7
layouts/partials/list_item.html
Normal file
7
layouts/partials/list_item.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<div class="media-body">
|
||||||
|
<a href="{{ .RelPermalink }}">
|
||||||
|
<h5>{{ .Title }}</h5>
|
||||||
|
</a>
|
||||||
|
<small>{{ partial "content-details.html" . }}</small>
|
||||||
|
<p>{{ partial "summary.html" . }}</p>
|
||||||
|
</div>
|
5
layouts/partials/summary.html
Normal file
5
layouts/partials/summary.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{{ if .Content }}
|
||||||
|
{{ .Summary | chomp }}{{ if .Truncated }}…{{ end }}
|
||||||
|
{{ else if .Params.subtitle }}
|
||||||
|
{{ .Params.subtitle | markdownify | emojify }}
|
||||||
|
{{ end }}
|
Loading…
Reference in a new issue