Added limit option and display option

This commit is contained in:
Leon Mika 2025-07-06 09:37:09 +10:00
parent d94e08674f
commit 79e4f94a6c
3 changed files with 41 additions and 10 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.DS_Store

View file

@ -0,0 +1,18 @@
<div class="h-entry">
{{ if .Title }}
<h2 class="p-name"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
{{ if .Params.custom_summary }}
<div class="p-summary">
<p>{{ .Summary | safeHTML }}<p>
</div>
{{ else }}
<div class="e-content">
{{ .Content }}
</div>
{{ end }}
{{ else }}
<div class="e-content">
{{ .Content }}
</div>
{{ end }}
</div>

View file

@ -18,14 +18,26 @@
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
<ul class="postlist"> {{- if (ne (.Get "limit") "") -}}
{{ range $pgr }} {{- $pgr = $pgr.Limit (int (.Get "limit")) -}}
{{- if (ne .LinkTitle "") -}} {{- end -}}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- else if (ne .Summary "") -}} {{- if (eq (.Get "display") "content") -}}
<li><a href="{{ .RelPermalink }}">{{ .Summary | safeHTML | truncate 70 }}</a></li> <div class="postlist postlist-display-content h-feed">
{{ range $pgr }}
{{ partial "_postlist/post-content.html" . }}
{{ end }}
</div>
{{- else -}} {{- else -}}
<ul class="postlist">
{{ range $pgr }}
{{- if (ne .LinkTitle "") -}}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- else if (ne .Summary "") -}}
<li><a href="{{ .RelPermalink }}">{{ .Summary | safeHTML | truncate 70 }}</a></li>
{{- e\lse -}}
<li><a href="{{ .RelPermalink }}">{{ .Content | safeHTML | truncate 70 }}</a></li> <li><a href="{{ .RelPermalink }}">{{ .Content | safeHTML | truncate 70 }}</a></li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>
{{- end -}}