Update: Project List

This commit is contained in:
TheJoKlLa 2020-03-06 17:20:22 +01:00
parent cd846d47de
commit 4c4122a921
9 changed files with 102 additions and 72 deletions

View File

@ -7,7 +7,7 @@
{{ if eq "Posts" $.Title }} {{ if eq "Posts" $.Title }}
{{partial "list-item-post.html" .}} {{partial "list-item-post.html" .}}
{{else}} {{else}}
{{ partial "list-item-project" . }} {{ partial "list-item-project.html" . }}
{{end}} {{end}}
{{end}} {{end}}

View File

@ -1,38 +1,11 @@
{{ partial "header" . }} {{ partial "header" . }}
<main> <main>
{{ if eq "Posts" $.Title }}
{{ partial "list-item" . }} {{partial "post.html" .}}
{{else}}
<br> <div class="text-justify">{{ .Content }}</div> {{ partial "project" . }}
{{end}}
<!-- related posts with the same tags -->
{{ $related := first 3 (where (where (where .Site.Pages.ByDate.Reverse ".Type" "==" "post") ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
{{ if $related }}
<h4 class="page-header">Related</h4>
{{ range $related }} {{ partial "list-item" . }} {{ end }}
{{ end }}
{{ if and .Site.DisqusShortname (not .Params.disableComments) }}
<h4 class="page-header">Comments</h4>
{{ template "_internal/disqus.html" . }}
{{ end }}
{{ if .Site.Params.talkHost }}
{{ partial "talk.html" . }}
{{ end }}
{{ if .Site.Params.coralHost }}
{{ partial "coral.html" . }}
{{ end }}
</main> </main>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

View File

@ -0,0 +1,22 @@
<div class="item-header">
{{ .Date.Format (.Site.Params.dateFormat | default "") | $.Scratch.Set "pub_date" }}
{{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }}
{{ with .ReadingTime }} {{ $.Scratch.Set "read_time" . }} {{ end }}
<h4>{{ .Title }}</h4>
<h5>{{ $.Scratch.Get "pub_date" }} - {{ $.Scratch.Get "read_time" }} minutes</h5>
<h5>{{ $.Scratch.Get "subtitle" }}</h5>
{{ range.Params.categories }}
<a href="{{"/categories/"|relLangURL }}{{.|urlize}}">
<kbd class="item-cat"> {{ . }} </kbd>
</a>
{{ end }}
{{ range .Params.tags }}
<a href="{{"/tags/"|relLangURL }}{{.|urlize}}">
<kbd class="item-tag"> {{ . }} </kbd>
</a>
{{ end }}
</div>

View File

@ -0,0 +1,29 @@
<div class="item-header">
{{ $.Scratch.Set "link" .RelPermalink }}
{{ with .Params.repo }}
{{ $repoHost := default "gitlab" $.Params.repoHost }}
{{ if eq "github" $repoHost }}
{{ printf "https://github.com/%s/%s/" $.Site.Params.githubUsername . | $.Scratch.Set "link" }}
{{ else if eq "gitlab" $repoHost }}
{{ printf "https://gitlab.com/%s/%s/" $.Site.Params.gitlabUsername . | $.Scratch.Set "link" }}
{{ end }}
{{ end }}
{{ with .Params.link }} {{ $.Scratch.Set "link" . }} {{ end }}
{{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }}
<h4><a href="{{ .Scratch.Get "link" }}">{{ .Title }}</a></h4>
<h5>{{ $.Scratch.Get "subtitle" }}</h5>
{{ range.Params.categories }}
<a href="{{"/categories/"|relLangURL }}{{.|urlize}}">
<kbd class="item-cat"> {{ . }} </kbd>
</a>
{{ end }}
{{ range .Params.tags }}
<a href="{{"/tags/"|relLangURL }}{{.|urlize}}">
<kbd class="item-tag"> {{ . }} </kbd>
</a>
{{ end }}
</div>

View File

@ -1,18 +1,4 @@
<div class="item"> <div class="list-item">
{{ $.Scratch.Set "link" .RelPermalink }}
{{ with .Params.repo }}
{{ $repoHost := default "github" $.Params.repoHost }}
{{ if eq "github" $repoHost }}
{{ printf "https://github.com/%s/%s/" $.Site.Params.githubUsername . | $.Scratch.Set "link" }}
{{ else if eq "gitlab" $repoHost }}
{{ printf "https://gitlab.com/%s/%s/" $.Site.Params.gitlabUsername . | $.Scratch.Set "link" }}
{{ else if eq "bitbucket" $repoHost }}
{{ printf "https://bitbucket.org/%s/%s/" $.Site.Params.bitbucketUsername . | $.Scratch.Set "link" }}
{{ end }}
{{ end }}
{{ with .Params.link }} {{ $.Scratch.Set "link" . }} {{ end }}
{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006") | $.Scratch.Set "pub_date" }} {{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006") | $.Scratch.Set "pub_date" }}
{{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }} {{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }}
{{ with .ReadingTime }} {{ $.Scratch.Set "read_time" . }} {{ end }} {{ with .ReadingTime }} {{ $.Scratch.Set "read_time" . }} {{ end }}

View File

@ -1,26 +1,14 @@
<div class="item"> <div class="list-item">
{{ with .Permalink }} {{ $.Scratch.Set "link" . }} {{ end }}
{{ $.Scratch.Set "link" .RelPermalink }} {{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }}
{{ with .Params.repo }} {{ with .ReadingTime }} {{ $.Scratch.Set "read_time" . }} {{ end }}
{{ $repoHost := default "github" $.Params.repoHost }}
{{ if eq "github" $repoHost }}
{{ printf "https://github.com/%s/%s/" $.Site.Params.githubUsername . | $.Scratch.Set "link" }}
{{ else if eq "gitlab" $repoHost }}
{{ printf "https://gitlab.com/%s/%s/" $.Site.Params.gitlabUsername . | $.Scratch.Set "link" }}
{{ else if eq "bitbucket" $repoHost }}
{{ printf "https://bitbucket.org/%s/%s/" $.Site.Params.bitbucketUsername . | $.Scratch.Set "link" }}
{{ end }}
{{ end }}
{{ with .Params.link }} {{ $.Scratch.Set "link" . }} {{ end }}
{{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }}
{{ with .ReadingTime }} {{ $.Scratch.Set "read_time" . }} {{ end }}
<h4><a href="{{ .Scratch.Get "link" }}">{{ .Title }}</a></h4> <h4><a href="{{ .Scratch.Get "link" }}">{{ .Title }}</a></h4>
<h5>{{ $.Scratch.Get "subtitle" }}</h5> <h5>{{ $.Scratch.Get "subtitle" }}</h5>
{{ range.Params.categories }} {{ range.Params.categories }}
<a href="{{"/categories/"|relLangURL }}{{.|urlize}}"> <a href="{{"/categories/"|relLangURL }}{{.|urlize}}">
<kbd class="item-cat"> {{ . }} </kbd> <kbd class="item-cat"> {{ . }} </kbd>
</a> </a>
{{ end }} {{ end }}
@ -29,4 +17,5 @@
<kbd class="item-tag"> {{ . }} </kbd> <kbd class="item-tag"> {{ . }} </kbd>
</a> </a>
{{ end }} {{ end }}
</div> </div>

View File

@ -0,0 +1,23 @@
{{ partial "header-post" .}}
<div class="item">
<br> <div class="text-justify">{{ .Content }}</div>
<!-- related posts with the same tags -->
{{ $related := first 3 (where (where (where .Site.Pages.ByDate.Reverse ".Type" "==" "post") ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
{{ if $related }}
<h4 class="page-header">Related</h4>
{{ range $related }} {{ partial "list-item" . }} {{ end }}
{{ end }}
{{ if and .Site.DisqusShortname (not .Params.disableComments) }}
<h4 class="page-header">Comments</h4>
{{ template "_internal/disqus.html" . }}
{{ end }}
</div>

View File

@ -0,0 +1,4 @@
{{ partial "header-project" .}}
<div class="item">
<br> <div class="text-justify">{{ .Content }}</div>
</div>

View File

@ -202,3 +202,7 @@ img {
background-color: var(--accent) !important; background-color: var(--accent) !important;
color: #f8f8f8 !important; color: #f8f8f8 !important;
} }
.list-item {
padding-top: 5px;
margin-top: 10px;
}