mirror of
https://github.com/lmika/postlist-for-micro.blog.git
synced 2025-08-02 07:46:08 +00:00
Added limit option and display option
This commit is contained in:
parent
d94e08674f
commit
79e4f94a6c
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
18
layouts/partials/_postlist/post-content.html
Normal file
18
layouts/partials/_postlist/post-content.html
Normal 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>
|
|
@ -18,14 +18,26 @@
|
|||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<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>
|
||||
{{- if (ne (.Get "limit") "") -}}
|
||||
{{- $pgr = $pgr.Limit (int (.Get "limit")) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (eq (.Get "display") "content") -}}
|
||||
<div class="postlist postlist-display-content h-feed">
|
||||
{{ range $pgr }}
|
||||
{{ partial "_postlist/post-content.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{- else -}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Content | safeHTML | truncate 70 }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
<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>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{- end -}}
|
Loading…
Reference in a new issue