mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 19:00:24 +00:00
attachments: adjust implementation to doc #252
This commit is contained in:
parent
2271ff4611
commit
f595aaa287
2 changed files with 5 additions and 5 deletions
|
@ -62,14 +62,14 @@ Be aware that if you use a multilingual website, you will need to have as many f
|
|||
|
||||
{{% /expand %}}
|
||||
|
||||
### Colored styled box, descending sort order
|
||||
### Info styled box, descending sort order
|
||||
|
||||
{{% attachments style="orange" sort="desc" /%}}
|
||||
{{% attachments style="info" sort="desc" /%}}
|
||||
|
||||
{{% expand "Show markup" %}}
|
||||
|
||||
````go
|
||||
{{%/* attachments style="orange" sort="desc" /*/%}}
|
||||
{{%/* attachments style="info" sort="desc" /*/%}}
|
||||
````
|
||||
|
||||
{{% /expand %}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{- $_hugo_config := `{ "version": 1 }` }}
|
||||
{{- $style := .Get "style" | default "transparent" }}
|
||||
{{- $title := .Get "title" | default ("Attachments-label" | T) }}
|
||||
{{- $title := .Get "title" | default ($style | T) | default ("Attachments-label" | T) }}
|
||||
{{- $icon := .Get "icon" | default "" }}
|
||||
{{- if and (not $icon) (eq (len $icon) 0) }}
|
||||
{{- $icon = "paperclip" }}
|
||||
|
@ -11,6 +11,7 @@
|
|||
{{- end }}
|
||||
{{- $icon = trim $icon " " }}
|
||||
{{- $sort := .Get "sort" | default "asc" }}
|
||||
{{- $pattern := .Get "pattern" | default "" }}
|
||||
<div class="box attachments {{ $style }}">
|
||||
<div class="box-label">{{ if $icon }}<i class="fas fa-{{ $icon }} fa-fw"></i> {{ end }}{{ $title }}</div>
|
||||
<ul class="box-content attachments-files">
|
||||
|
@ -22,7 +23,6 @@
|
|||
{{- $fileLink = replace (replace $fileLink "\\" "/") "content/" "" }}
|
||||
{{- $fileDir := printf "%s/%s" (.Page.Language.ContentDir | default "content") .Page.File.Dir }}
|
||||
{{- $fileDir = replace $fileDir "\\" "/" }}
|
||||
{{- $pattern := .Get "pattern" | default "" }}
|
||||
{{- range sort (readDir (printf "%s%s" $fileDir $filesName) ) "Name" $sort }}
|
||||
{{- if findRE $pattern .Name}}
|
||||
{{- $size := .Size }}
|
||||
|
|
Loading…
Reference in a new issue