Add icon to snippet list

This commit is contained in:
Daniel_I_Am 2022-06-19 17:22:35 +02:00
parent 3148adb67f
commit e9d56c009c
3 changed files with 13 additions and 2 deletions

8
archetypes/snippet.md Normal file
View File

@ -0,0 +1,8 @@
---
title: "{{ replace .File.ContentBaseName "-" " " | title }}"
date: {{ .Date }}
tags: []
draft: true
icon: null
---

View File

@ -3,6 +3,7 @@ title: "Seconds since last pacman sync"
date: 2022-06-11T08:45:13Z date: 2022-06-11T08:45:13Z
tags: ["archlinux", "linux", "pacman"] tags: ["archlinux", "linux", "pacman"]
draft: false draft: false
icon: shell
--- ---
## Result ## Result

View File

@ -25,8 +25,9 @@
{{ if $pagination }} {{ if $pagination }}
{{ $paginator := $page.Paginate $entries }} {{ $paginator := $page.Paginate $entries }}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}
{{ $iconName := default "default" .Params.icon }}
<li class="list-item" data-href="{{ .Permalink }}" role="button" tabindex="0"> <li class="list-item" data-href="{{ .Permalink }}" role="button" tabindex="0">
<img class="list-item-image" src="//via.placeholder.com/128" alt="{{ index $ "labelSingular" }} Topic"> <img class="list-item-image" src="/icons/{{ $iconName }}.svg" alt="{{ index $ "labelSingular" }} Topic">
<div class="list-item-text"> <div class="list-item-text">
<h4 class="list-item-title">{{ .Title }}</h4> <h4 class="list-item-title">{{ .Title }}</h4>
<span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span> <span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span>
@ -36,8 +37,9 @@
{{ template "_internal/pagination.html" $page }} {{ template "_internal/pagination.html" $page }}
{{ else }} {{ else }}
{{ range ( first $maximumListSize $entries ) }} {{ range ( first $maximumListSize $entries ) }}
{{ $iconName := default "default" .Params.icon }}
<li class="list-item" data-href="{{ .Permalink }}" role="button" tabindex="0"> <li class="list-item" data-href="{{ .Permalink }}" role="button" tabindex="0">
<img class="list-item-image" src="//via.placeholder.com/128" alt="{{ index $ "labelSingular" }} Topic"> <img class="list-item-image" src="/icons/{{ $iconName }}.svg" alt="{{ index $ "labelSingular" }} Topic">
<div class="list-item-text"> <div class="list-item-text">
<h4 class="list-item-title">{{ .Title }}</h4> <h4 class="list-item-title">{{ .Title }}</h4>
<span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span> <span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span>