feat: Add button to distinguish category on lists
This commit is contained in:
parent
70189e8e8b
commit
1c2f164871
3 changed files with 42 additions and 1 deletions
|
@ -161,3 +161,14 @@ h1 {
|
||||||
.card-link {
|
.card-link {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.category-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 1em;
|
||||||
|
right: 1em;
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
margin-right: 2.25em;
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
<div class="col-xl-6 mb-4">
|
<div class="col-xl-6 mb-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
{{ partial "category-button" . }}
|
||||||
|
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{{/* Thumbnail images should be stored as 'thumbnail'.* in the page bundle, but
|
{{/* Thumbnail images should be stored as 'thumbnail'.* in the page bundle, but
|
||||||
historically they might have been referenced as 'thumbnail' in the front
|
historically they might have been referenced as 'thumbnail' in the front
|
||||||
|
@ -53,7 +56,7 @@
|
||||||
{{ .Summary }}
|
{{ .Summary }}
|
||||||
<strong
|
<strong
|
||||||
><small
|
><small
|
||||||
><a href="{{ $link }}">Read more »</a></small
|
><a href="{{ $link }}">Read more »</a></small
|
||||||
></strong
|
></strong
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
27
layouts/partials/category-button.html
Normal file
27
layouts/partials/category-button.html
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<div class="category-button">
|
||||||
|
{{ with .Param "categories" }}
|
||||||
|
{{ range $i, $category := . }}
|
||||||
|
{{ if eq $i 0 }}
|
||||||
|
{{ with $.Site.GetPage (printf "/%s/%s" "categories" $category) }}
|
||||||
|
{{ $iconDictionary := dict
|
||||||
|
"video" "fad fa-video"
|
||||||
|
"paper" "fad fa-book"
|
||||||
|
"poster" "fad fa-presentation"
|
||||||
|
"thesis" "fad fa-graduation-cap"
|
||||||
|
"presentation" "fad fa-podium"
|
||||||
|
"web" "fad fa-globe"
|
||||||
|
}}
|
||||||
|
{{ $categoryIcon := index $iconDictionary $category }}
|
||||||
|
<a
|
||||||
|
href="{{ .RelPermalink }}"
|
||||||
|
class="btn btn-dark btn-sm"
|
||||||
|
data-bs-toggle="tooltip"
|
||||||
|
title="{{ humanize $category }}"
|
||||||
|
>
|
||||||
|
<i class="{{ $categoryIcon | default "fad fa-tag" }} fa-fw"></i>
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
Loading…
Reference in a new issue