github.com/mweagle/Sparta@v1.15.0/docs_source/themes/hugo-theme-learn/layouts/shortcodes/attachments.html (about)

     1  {{ $_hugo_config := `{ "version": 1 }` }}
     2  <section class="attachments {{ with .Get "style"}}{{.}}{{ end }}">
     3  	<label>
     4  		<i class="fas fa-paperclip" aria-hidden="true"></i>
     5  		{{with .Get "title"}}{{.}}{{else}}{{T "Attachments-label"}}{{end}}
     6  	</label>
     7  	{{if eq .Page.File.BaseFileName "index"}}
     8  		{{$.Scratch.Add "filesName" "files"}}
     9  	{{else}}
    10  		{{$.Scratch.Add "filesName" (printf "%s.files" .Page.File.BaseFileName)}}
    11  	{{end}}
    12  	<div class="attachments-files">
    13  	{{ range (readDir (printf "./content/%s%s" .Page.File.Dir ($.Scratch.Get "filesName")) ) }}
    14  		{{ $fileDir := replace $.Page.File.Dir "\\" "/" }}
    15  		{{if ($.Get "pattern")}}
    16  			{{if (findRE ($.Get "pattern") .Name)}}
    17  				<li>
    18  					<a href="{{ (printf "%s%s/%s" $fileDir ($.Scratch.Get "filesName") .Name) | relURL }}" >
    19  						{{.Name}}
    20  					</a>
    21  					({{div .Size 1024 }} ko)
    22  				</li>
    23  			{{end}}
    24  		{{else}}
    25  			<li>
    26  				<a href="{{ (printf "%s%s/%s" $fileDir ($.Scratch.Get "filesName") .Name) | relURL }}" >
    27  					{{.Name}}
    28  				</a>
    29  				({{div .Size 1024 }} ko)
    30  			</li>
    31  		{{end}}
    32  	{{end}}
    33  	<div>
    34  	{{.Inner}}
    35  </section>
    36