fosscat-site/layouts/index.html

71 lines
2.0 KiB
HTML

{{ define "main" }}
<section class="home-about">
<div class="avatar">
{{ if isset .Site.Params "avatarurl" }}
<img class={{ .Site.Params.AvatarSize | default "size-m" }} src='{{ .Scratch.Get "avatarImgSrc" }}'
alt="{{ .Site.Params.AvatarAltText|default " avatar" }}">
{{ end }}
</div>
<h1>{{ .Site.Title }}</h1>
{{ if isset .Site.Params "description" }}
<h2>{{ .Site.Params.Description }}</h2>
{{ end }}
</section>
<div class="flex-break"></div>
{{ if isset .Site.Params "socialicons" }}
<div class="gk-social-icons">
<ul class="gk-social-icons-list">
{{ range .Site.Params.SocialIcons }}
<li class="gk-social-icon">
<a href="{{ .url }}" {{ if .rel }}rel="{{ .rel }}" {{ end }} aria-label="Learn more on {{ .name }}">
<img class="svg-inject" src="{{ relURL " svg/icons/" }}{{ .name | lower }}.svg" alt="">
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ if os.FileExists "index-about.md" }}
<div class="markdown-content">
{{ readFile "index-about.md" | markdownify }}
</div>
{{ end }}
{{ if isset .Site.Params "showpostsonhomepage" }}
<div class="home-posts list-posts">
<h2>Recent Posts</h2>
{{ $posts := where .Site.Pages "Params.type" "post" }}
{{ if eq .Site.Params.ShowPostsOnHomePage "popular" }}
{{ range $posts.ByWeight | first (or .Site.Params.NumberPostsOnHomePage 4) }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ else if eq .Site.Params.ShowPostsOnHomePage "recent" }}
{{ range $posts.ByDate.Reverse | first (or .Site.Params.NumberPostsOnHomePage 4) }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ end }}
</div>
{{ end }}
{{/* TILs Section */}}
{{ $tils := where .Site.Pages "Params.type" "tils" }}
{{ $tilsToShow := $tils.ByDate.Reverse | first (or .Site.Params.NumberTilsOnHomePage 3) }}
{{ if gt (len $tilsToShow) 0 }}
<div class="home-posts list-posts">
<h2>Recent TILs</h2>
{{ range $tilsToShow }}
{{- partial "list-posts.html" . -}}
{{ end }}
</div>
{{ end }}
{{ end }}