mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-06 00:33:39 +00:00
Tweak theme
This commit is contained in:
1
themes/custom-theme/layouts/shortcodes/cv.html
Normal file
1
themes/custom-theme/layouts/shortcodes/cv.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ partial "cv/cv.html" . }}
|
16
themes/custom-theme/layouts/shortcodes/prism-features.html
Normal file
16
themes/custom-theme/layouts/shortcodes/prism-features.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ $type := .Get 0 }}
|
||||
{{ $languages := readDir "node_modules/prismjs/components" }}
|
||||
{{ $plugins := readDir "node_modules/prismjs/plugins" }}
|
||||
|
||||
{{ if eq $type "languages" }}
|
||||
{{ range after 1 $languages -}}
|
||||
{{ $lang := .Name | replaceRE ".*\\.min\\.js" "" | replaceRE "prism-([\\w-]*).js" "${1}" -}}
|
||||
{{ if not (eq $lang "") }}
|
||||
{{ $lang -}}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
{{ else if eq $type "plugins" }}
|
||||
{{ range $plugins }}
|
||||
{{ path.Base .Name -}}
|
||||
{{ end }}
|
||||
{{ end }}
|
57
themes/custom-theme/layouts/shortcodes/video.html
Normal file
57
themes/custom-theme/layouts/shortcodes/video.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!--
|
||||
Embed videos from Hugo Page Resources.
|
||||
|
||||
Setting src="my-video" with the Page Bundle containing...
|
||||
|
||||
- my-video.png
|
||||
- my-video.mp4
|
||||
- my-video.webm
|
||||
|
||||
...will render the following:
|
||||
|
||||
<video poster="my-video.png">
|
||||
<source src="my-video.mp4" type="video/mp4" />
|
||||
<source src="my-video.webm" type="video/webm" />
|
||||
</video>
|
||||
-->
|
||||
|
||||
{{ $src := .Get "src" }}
|
||||
|
||||
{{ if strings.HasPrefix $src "./" }}
|
||||
<!-- Strip "./" prefix from relative path -->
|
||||
{{ $src = substr $src 2 }}
|
||||
{{ end }}
|
||||
|
||||
{{ $poster := ((.Page.Resources.ByType "image").GetMatch (printf "%s*" $src)) }}
|
||||
{{ $videos := (.Page.Resources.ByType "video").Match (printf "%s*" $src) }}
|
||||
|
||||
|
||||
<!--prettier-ignore-->
|
||||
{{ if .Get "caption" }}
|
||||
<figure>
|
||||
{{ end }}
|
||||
|
||||
{{ if $videos }}
|
||||
<video
|
||||
{{ if eq (.Get "autoplay") "true" }}autoplay{{ end }}
|
||||
{{ if eq (.Get "controls" | default "true") "true" }}controls{{ end }}
|
||||
{{ with .Get "height" }}height="{{ . }}"{{ end }}
|
||||
{{ if eq (.Get "loop") "true" }}loop{{ end }}
|
||||
{{ if eq (.Get "muted") "true" }}muted{{ end }}
|
||||
{{ with $poster }}poster="{{ .RelPermalink }}"{{ end }}
|
||||
{{ with .Get "preload" }}preload="{{ . }}"{{ end }}
|
||||
{{ with .Get "width" }}width="{{ . }}"{{ end }}
|
||||
{{ if eq (.Get "playsinline" | default "true") "true" }}playsinline{{ end }}
|
||||
>
|
||||
{{- range $videos -}}
|
||||
<source src="{{ .RelPermalink }}" type="{{ .MediaType }}" />
|
||||
{{- end -}}
|
||||
</video>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<!--prettier-ignore-->
|
||||
{{ if .Get "caption" }}
|
||||
<figcaption>{{ .Page.RenderString (.Get "caption") }}</figcaption>
|
||||
</figure>
|
||||
{{ end }}
|
Reference in New Issue
Block a user