1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-30 01:06:00 -04:00

clean up shortcodes

This commit is contained in:
2021-12-13 20:46:28 -05:00
parent 964c4ef543
commit cda7d538a6
15 changed files with 64 additions and 25 deletions
+9 -1
View File
@@ -1,3 +1,11 @@
<div class="embed {{ .Name }}">
<iframe src="{{ .Get "src" }}"{{ with .Get "title" }} title="{{ . }}"{{ end }}{{ with .Get "sandbox" }} sandbox="{{ . }}"{{ end }}></iframe>
<iframe
src="{{ .Get "src" }}"
{{ with .Get "title" }}
title="{{ . }}"
{{ end }}
{{ with .Get "sandbox" }}
sandbox="{{ . }}"
{{ end }}>
</iframe>
</div>
+4 -2
View File
@@ -6,9 +6,11 @@
{{- with .Inner }}
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}"
{{- else }}
{{ with .Get "alt" }} alt="{{ . | safeHTML }}"{{ end }}
{{ with .Get "alt" }}
alt="{{ . | safeHTML }}"
{{ end }}
{{- end -}}
>
/>
{{ if .Get "link" }}</a>{{ end }}
{{ with .Inner -}}
+13 -6
View File
@@ -1,10 +1,17 @@
{{- $optimized := partial "functions/optimize-image" . -}}
<p align="center">
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ print .Site.Params.baseUrl $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
{{- with .Get "alt" }} alt="{{ . | safeHTML }}"{{ end }}
{{- with .Inner }} alt="{{ . | $.Page.RenderString | plainify | safeHTML }}"{{ end }}>
{{ if .Get "link" }}</a>{{ end }}
{{ with .Inner }}<br>{{ . | $.Page.RenderString | safeHTML }}{{ end -}}
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ print .Site.Params.baseUrl $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
{{- with .Inner }}
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}"
{{- else }}
{{ with .Get "alt" }}
alt="{{ . | safeHTML }}"
{{ end }}
{{- end -}}
/>
{{ if .Get "link" }}</a>{{ end }}
{{ with .Inner }}<br>{{ . | $.Page.RenderString | safeHTML }}{{ end -}}
</p>
+1 -1
View File
@@ -6,5 +6,5 @@
</div>
{{- define "__shortcode_instagram_js" }}
<script async src="https://www.instagram.com/embed.js"></script>
<script async defer src="https://www.instagram.com/embed.js"></script>
{{- end }}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- $url := printf "https://publish.twitter.com/oembed?lang=en&omit_script=true&dnt=true&align=center&url=%s" (index .Params 0 | safeURL) -}}
{{- $url := printf "https://publish.twitter.com/oembed?lang=en&omit_script=true&dnt=true&url=%s" (index .Params 0 | safeURL) -}}
{{- $json := getJSON $url -}}
<div class="embed {{ .Name }}">
+1 -1
View File
@@ -1,4 +1,4 @@
{{- $url := printf "https://publish.twitter.com/oembed?lang=en&omit_script=true&dnt=true&align=center&url=%s" (index .Params 0 | safeURL) -}}
{{- $url := printf "https://publish.twitter.com/oembed?lang=en&omit_script=true&dnt=true&url=%s" (index .Params 0 | safeURL) -}}
{{- $json := getJSON $url -}}
{{ $json.html | safeHTML }}
+8 -3
View File
@@ -1,7 +1,12 @@
<div class="embed {{ .Name }}" style="padding:75% 0 0 0;position:relative;">
<iframe src="https://player.vimeo.com/video/{{ .Get "id" }}&amp;dnt=1" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="fullscreen" allowfullscreen></iframe>
<div class="embed {{ .Name }}">
<iframe
class="vimeo-player"
src="https://player.vimeo.com/video/{{ .Get "id" }}&amp;dnt=1"
allow="fullscreen"
allowfullscreen>
</iframe>
</div>
{{- define "__shortcode_vimeo_js" }}
<script src="https://player.vimeo.com/api/player.js"></script>
<script async defer src="https://player.vimeo.com/api/player.js"></script>
{{ end }}
+1
View File
@@ -2,6 +2,7 @@
<iframe
class="youtube-player"
src="https://www.youtube-nocookie.com/embed/{{ index .Params 0 }}?autoplay=0&amp;hl=en&amp;fs=1&amp;showinfo=1&amp;rel=0&amp;iv_load_policy=3"
allow="fullscreen"
allowfullscreen>
</iframe>
</div>