mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-28 15:03:00 +00:00
ec4e6f9df2
git-subtree-dir: docs git-subtree-split: f887bd7b4e3e7c7e76cd63951e5b0d37d8fe0ac7
17 lines
900 B
HTML
17 lines
900 B
HTML
{{ $file := .Get "file" }}
|
|
{{ $isHTML := strings.HasSuffix $file "html" }}
|
|
<div class="code relative bg-primary-color" id="{{ $file | urlize}}">
|
|
{{- with $file -}}
|
|
<div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div>
|
|
{{- end -}}
|
|
|
|
{{ if ne (.Get "copy") "false" }}
|
|
<button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
|
|
</button>
|
|
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
|
|
{{end}}
|
|
<div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}>
|
|
{{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}
|
|
</div>
|
|
|
|
</div>
|