Add news support to website theme
All checks were successful
Builds / ExectOS WebSite (push) Successful in 31s

This commit is contained in:
Rafal Kupiec 2024-08-21 11:44:00 +02:00
parent f26705e22d
commit cd6b01003b
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
4 changed files with 89 additions and 6 deletions

View File

@ -3,11 +3,11 @@
{{- partial "head.html" . -}}
<body>
{{- partial "header.html" . -}}
<div class="wrapper_content">
<div class="content">
{{ .Content }}
</div>
</div>
{{- partial "footer.html" . -}}
<div class="wrapper_content">
<div class="content">
{{ .Content }}
</div>
</div>
{{- partial "footer.html" . -}}
</body>
</html>

View File

@ -0,0 +1,2 @@
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" (slice "news")) }}
{{ partial "list.html" (dict "context" . "paginator" $paginator) }}

View File

@ -0,0 +1,39 @@
{{ with .context }}
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
<body>
{{- partial "header.html" . -}}
<div class="wrapper_content">
<div class="content">
<h2>{{ .Title }}</h2>
{{ range $.paginator.Pages }}
<section class="news">
<h3><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
<div class="news_info">
<div class="news_author">{{ if isset .Params "author" }}by {{ .Params.author }}{{ end }}</div>
<div class="news_date"><i class="fa fa-calendar"></i> {{ .Date.Format .Site.Params.dateFormat }}</div>
</div>
<div class="news_intro">{{ .Summary }}</div>
</section>
{{ end }}
<div class="pagination">
<ul>
{{ if .Paginator.HasPrev }}
<li><a href="{{ .Site.BaseURL }}{{ .Paginator.Prev.URL }}">&larr; Newer</a></li>
{{ else }}
<li><a href="#">&larr; Newer</a></li>
{{ end }}
{{ if .Paginator.HasNext }}
<li><a href="{{ .Site.BaseURL }}{{ .Paginator.Next.URL }}">Older &rarr;</a></li>
{{ else }}
<li><a href="#">Older &rarr;</a></li>
{{ end }}
</ul>
</div>
</div>
</div>
{{- partial "footer.html" . -}}
</body>
</html>
{{ end }}

View File

@ -224,6 +224,48 @@ pre code {
text-align : center;
}
.news_author {
color : #999999;
float : left;
}
.news_date {
color : #999999;
float : right;
}
.news_info {
margin-top : -1em;
margin-bottom : 3em;
}
.news_intro {
margin-bottom : 50px;
margin-left : -1em;
text-align : justify;
}
.pagination {
margin : 0px;
padding : 0 0 0 0;
text-align : center;
}
.pagination a {
text-decoration : none;
}
.pagination li {
display : inline;
margin-left : 100px;
}
.pagination ul {
margin : 0px;
padding : 0px;
text-align : center;
}
.wrapper_content {
margin-bottom : 2.5em;
padding : 6em 0 0 0;