feat: recent posts section/partial
This commit is contained in:
parent
0439c163a0
commit
0293c12217
5 changed files with 54 additions and 29 deletions
|
@ -15,6 +15,9 @@
|
|||
<article>
|
||||
{{partial "toc.html" .}}
|
||||
{{partial "textprocessing.html" . }}
|
||||
{{if $.Site.Data.config.enableRecentNotes}}
|
||||
{{partial "recent.html" . }}
|
||||
{{end}}
|
||||
</article>
|
||||
{{partial "footer.html" .}}
|
||||
</div>
|
||||
|
|
|
@ -4,11 +4,17 @@
|
|||
<div class="section">
|
||||
<div class="desc">
|
||||
<h3><a href="{{ .Permalink }}">{{- .Title -}}</a></h3>
|
||||
<ul class="tags">
|
||||
{{ range (.GetTerms "tags") }}
|
||||
<li><a href="{{ .Permalink }}">{{ .LinkTitle | title}}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<p>{{- .Summary -}}{{if .Truncated}}...{{end}}</p>
|
||||
</div>
|
||||
<p class="meta">
|
||||
{{ .ReadingTime }} minute read. Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
{{- end -}}
|
||||
|
|
12
layouts/partials/recent.html
Normal file
12
layouts/partials/recent.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<div class="content-list">
|
||||
<h2>Recent Notes</h2>
|
||||
<!--
|
||||
You can also configure this to find related pages!
|
||||
All you need to pass into the "page-list.html" partial
|
||||
is a collection of pages.
|
||||
https://gohugo.io/content-management/related/
|
||||
-->
|
||||
{{$notes := .Site.RegularPages}}
|
||||
{{partial "page-list.html" (first 3 $notes)}}
|
||||
</div>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue