Skip to content

Commit 9209e78

Browse files
Added numbering to gallery
1 parent 8a56310 commit 9209e78

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎assets/css/extended/misc.css‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,4 +390,25 @@ text-decoration: none;
390390

391391
.info-tooltip .tooltip-text a:hover {
392392
text-decoration: underline;
393+
}
394+
395+
.gallery-item {
396+
position: relative;
397+
}
398+
399+
.gallery-number {
400+
position: absolute;
401+
top: 10px;
402+
left: 10px;
403+
background: rgba(0, 0, 0, 0.75);
404+
color: white;
405+
width: 30px;
406+
height: 30px;
407+
border-radius: 50%;
408+
display: flex;
409+
align-items: center;
410+
justify-content: center;
411+
font-size: 0.9rem;
412+
font-weight: 600;
413+
z-index: 5;
393414
}

‎themes/hugo-PaperMod/layouts/shortcodes/gallery.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<div class="gallery">
22
{{ $images := split .Inner "\n" }}
33
<div class="gallery-grid">
4+
{{ $index := 0 }}
45
{{ range $images }}
56
{{ $item := findRE `"([^"]*)"` . }}
67
{{ if ge (len $item) 2 }}
8+
{{ $index = add $index 1 }}
79
<figure class="gallery-item">
810
<a href="{{ trim (index $item 0) `"` }}" class="lightbox">
11+
<span class="gallery-number">{{ $index }}</span>
912
<img
1013
src="{{ trim (index $item 0) `"` }}"
1114
alt="{{ trim (index $item 1) `"` }}"

0 commit comments

Comments
 (0)