HUGO

Shortcode for Google slide presentation embed

Hi,

A colleague has embedded a Google docs slide show on his website. It’s derived from a PowerPoint presentation.

The code is:

<p><iframe src="https://docs.google.com/presentation/d/1PNr-sD5-70zo7vKtuKZXW0hkqGm7spuqgkGxffsx-QU/embed?start=false&#038;loop=false&#038;delayms=3000" frameborder="0" width="800" height="600" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe></p>

My knowledge of html is very rudimentary.

What would an appropriate Shortcode be for a Hugo site ?

(I’ve used a Shortcode to embed a YouTube video on my site.)

Thanks!

Howard

Here’s the built-in youtube shortcode. See if you can adapt it to your needs.

{{ if .IsNamedParams }}
<div {{ if .Get "class" }}class="{{ .Get "class" }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}>
  <iframe src="//www.youtube.com/embed/{{ .Get "id" }}?{{ with .Get "autoplay" }}{{ if eq . "true" }}autoplay=1{{ end }}{{ end }}" 
  {{ if not (.Get "class") }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0"></iframe>
</div>{{ else }}
<div {{ if len .Params | eq 2 }}class="{{ .Get 1 }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}>
  <iframe src="//www.youtube.com/embed/{{ .Get 0 }}" {{ if len .Params | eq 1 }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0"></iframe>
 </div>
{{ end }}

This worked for me https://ashish.one/gist/add-responsive-google-slides-on-hugo/