You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

4 years ago
  1. {{ define "main" }}
  2. {{ if .Content }}
  3. <div class="index-content {{ if .Params.framed -}}framed{{- end -}}">
  4. {{ .Content }}
  5. </div>
  6. {{ end }}
  7. <div class="posts">
  8. {{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
  9. {{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
  10. {{ $PageContext := . }}
  11. {{ if .IsHome }}
  12. {{ $PageContext = .Site }}
  13. {{ end }}
  14. {{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
  15. {{ range $paginator.Pages }}
  16. <div class="post on-list">
  17. <h1 class="post-title">
  18. <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
  19. </h1>
  20. <div class="post-meta">
  21. <span class="post-date">
  22. {{ .Date.Format "2006-01-02" }}
  23. </span>
  24. {{ with .Params.Author }}
  25. <span class="post-author">:: {{ . }}</span>
  26. {{ end }}
  27. </div>
  28. {{ if .Params.tags }}
  29. <span class="post-tags">
  30. {{ range .Params.tags }}
  31. #<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
  32. {{- . -}}
  33. </a>&nbsp;
  34. {{ end }}
  35. </span>
  36. {{ end }}
  37. {{ if .Params.Cover }}
  38. <img src="{{ .Params.Cover | absURL }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
  39. {{ end }}
  40. <div class="post-content">
  41. {{ if .Params.showFullContent }}
  42. {{ .Content | markdownify }}
  43. {{ else if .Description }}
  44. {{ .Description | markdownify }}
  45. {{ else }}
  46. {{ if .Truncated }}
  47. {{ .Summary }}
  48. {{ end }}
  49. {{ end }}
  50. </div>
  51. {{ if not .Params.showFullContent }}
  52. <div>
  53. <a class="read-more button"
  54. href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
  55. </div>
  56. {{ end }}
  57. </div>
  58. {{ end }}
  59. {{ partial "pagination.html" . }}
  60. </div>
  61. {{ end }}