mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 12:36:20 -04:00
more shortcode tweaks for valid RSS
This commit is contained in:
parent
77f3233702
commit
951c5f2c3f
@ -1 +0,0 @@
|
||||
codepen.html
|
1
layouts/shortcodes/codepen.rss.html
Normal file
1
layouts/shortcodes/codepen.rss.html
Normal file
@ -0,0 +1 @@
|
||||
<p><a href="https://codepen.io/{{ .Get "username" }}/pen/{{ .Get "id" }}" target="_blank" rel="noopener">Open this CodePen in a new window.</a></p>
|
@ -1 +0,0 @@
|
||||
gh-buttons.html
|
4
layouts/shortcodes/gh-buttons.rss.html
Normal file
4
layouts/shortcodes/gh-buttons.rss.html
Normal file
@ -0,0 +1,4 @@
|
||||
<p style="text-align: center;">
|
||||
<a href="https://github.com/{{ .Get "username" }}/{{ .Get "repo" }}">Star {{ .Get "username" }}/{{ .Get "repo" }} on GitHub</a>
|
||||
<a href="https://github.com/{{ .Get "username" }}/{{ .Get "repo" }}/issues">Issues for {{ .Get "username" }}/{{ .Get "repo" }} on GitHub</a>
|
||||
</p>
|
@ -1,7 +1,8 @@
|
||||
{{- /* Automatic resizing for HiDPI/retina images */ -}}
|
||||
|
||||
{{- $original := .Page.Resources.GetMatch (.Get "src") -}}
|
||||
{{- .Scratch.Set "image" $original -}}
|
||||
|
||||
<!-- TODO: automatically pull max-width of page -->
|
||||
{{- $maxWidth := 910 -}}
|
||||
{{- $setWidth := 0 -}}
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
<!-- Automatic resizing for HiDPI/retina images -->
|
||||
{{- /* Automatic resizing for HiDPI/retina images */ -}}
|
||||
|
||||
{{- $original := .Page.Resources.GetMatch (.Get "src") -}}
|
||||
{{- .Scratch.Set "image" $original -}}
|
||||
|
||||
<!-- TODO: automatically pull max-width of page -->
|
||||
{{- $maxWidth := 910 -}}
|
||||
{{- $setWidth := 0 -}}
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
image.html
|
35
layouts/shortcodes/image.rss.html
Normal file
35
layouts/shortcodes/image.rss.html
Normal file
@ -0,0 +1,35 @@
|
||||
{{- /* Automatic resizing for HiDPI/retina images */ -}}
|
||||
|
||||
{{- $original := .Page.Resources.GetMatch (.Get "src") -}}
|
||||
{{- .Scratch.Set "image" $original -}}
|
||||
|
||||
{{- $maxWidth := 910 -}}
|
||||
{{- $setWidth := 0 -}}
|
||||
|
||||
{{- if .Get "width" -}}
|
||||
{{- $setWidth = (int (.Get "width")) -}}
|
||||
{{- $retinaWidth := (mul $setWidth 2) -}}
|
||||
|
||||
{{- if gt $original.Width $retinaWidth -}}
|
||||
{{- $finalWidth := (printf "%dx" $retinaWidth) -}}
|
||||
{{- .Scratch.Set "image" ($original.Resize $finalWidth) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $setWidth = $maxWidth -}}
|
||||
{{- if gt $original.Width 1820 -}}
|
||||
{{- .Scratch.Set "image" ($original.Resize "1820x") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $image := .Scratch.Get "image" -}}
|
||||
|
||||
{{- $origRatio := (div (float $image.Height) $image.Width) -}}
|
||||
{{- $displayWidth := $setWidth -}}
|
||||
{{- $displayHeight := (math.Ceil (mul $origRatio $setWidth)) -}}
|
||||
|
||||
<p style="text-align: center;">
|
||||
<img src="{{ $image.Permalink }}" width="{{ $displayWidth }}" height="{{ $displayHeight }}"
|
||||
{{- with .Get "alt" }} alt="{{ . }}"{{ end }}
|
||||
{{- with .Get "caption" }} title="{{ . }}"{{ end }}>
|
||||
{{ with .Get "caption" }}<br>{{ . }}{{ end -}}
|
||||
</p>
|
5
layouts/shortcodes/tweet.rss.html
Normal file
5
layouts/shortcodes/tweet.rss.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{- /* Modified from /tpl/tplimpl/embedded/templates/shortcodes/twitter.html to fetch tweet without script (&omit_script=1) */ -}}
|
||||
|
||||
{{- $url := printf "https://api.twitter.com/1/statuses/oembed.json?id=%d&omit_script=true" (index .Params 0) -}}
|
||||
{{- $json := getJSON $url -}}
|
||||
{{- $json.html | safeHTML -}}
|
@ -1 +0,0 @@
|
||||
youtube.html
|
1
layouts/shortcodes/youtube.rss.html
Normal file
1
layouts/shortcodes/youtube.rss.html
Normal file
@ -0,0 +1 @@
|
||||
<p style="text-align: center;"><a href="https://www.youtube.com/watch?v={{ index .Params 0 }}">Watch this video on YouTube.</a></p>
|
Loading…
x
Reference in New Issue
Block a user