|
1 | 1 | {{ define "main" }}
|
2 | 2 | <div class="apps-list">
|
| 3 | + <!-- data/TYPENAME/ITEMNAME/hugo.json--> |
| 4 | + {{ $curTypeName := ($.Permalink | path.Dir | path.Split).File }} |
| 5 | + <h1>{{- $curTypeName -}}</h1> |
| 6 | + {{ range $typeName, $type := .Site.Data }} |
| 7 | + {{ if eq $typeName $curTypeName }} |
| 8 | + {{ range $itemName, $itemMap := $type }} |
| 9 | + {{ $item := $itemMap.hugo }} |
| 10 | + {{ $title := $item.title | default $itemName }} |
| 11 | + {{ $itemUrl := $item.url | default (print "/" $typeName "/" $itemName | absURL) }} |
| 12 | + {{ $imageUrl := $item.image | default (print "/img/no-image.svg" | absURL) }} |
| 13 | + <div class="apps-app-item"> |
| 14 | + <div class="apps-app-icon"> |
| 15 | + <a href="{{- $itemUrl -}}"> |
| 16 | + <img src="{{- $imageUrl -}}"/> |
| 17 | + </a> |
| 18 | + </div> |
| 19 | + <div class="apps-app-name"> |
| 20 | + <a href="{{- $itemUrl -}}"> |
| 21 | + <h6>{{- $title -}}</h6> |
| 22 | + </a> |
| 23 | + </div> |
| 24 | + </div> |
| 25 | + {{ end }} |
| 26 | + {{ end }} |
| 27 | + {{ end }} |
3 | 28 | {{ range .Pages }}
|
4 | 29 | <div class="apps-app-item">
|
5 | 30 | <div class="apps-app-icon">
|
6 |
| - <a href="{{ .Permalink }}"> |
7 |
| - {{ if or (not (isset .Params "img")) (eq .Params.img "") }} |
8 |
| - <img src="{{ .Site.BaseURL }}/img/no-image.svg"/> |
9 |
| - {{ else }} |
10 |
| - <img src="{{ .Params.img }}"/> |
11 |
| - {{ end }} |
| 31 | + {{ $title := (.Permalink | path.Dir | path.Split).File }} |
| 32 | + {{ $itemUrl := .Permalink }} |
| 33 | + {{ $imageUrl := .Params.img | default (print "/img/no-image.svg" | absURL) }} |
| 34 | + <a href="{{- $itemUrl -}}"> |
| 35 | + <img src="{{- $imageUrl -}}"/> |
12 | 36 | </a>
|
13 | 37 | </div>
|
14 | 38 | <div class="apps-app-name">
|
15 |
| - <a href="{{ .Permalink }}"> |
16 |
| - <h6>{{- .Title -}}</h6> |
| 39 | + <a href="{{- $itemUrl -}}"> |
| 40 | + <h6>{{- $title -}}</h6> |
17 | 41 | </a>
|
18 | 42 | </div>
|
19 | 43 | </div>
|
|
0 commit comments