From 7b3edc293144dd450e87ca32f238221c21eb1b47 Mon Sep 17 00:00:00 2001 From: Zach Bayoff <30878344+zbayoff@users.noreply.github.com> Date: Sat, 12 Oct 2019 12:10:14 -0400 Subject: [PATCH] tpl: Add optional "title" attribute to iframe in Vimeo shortcode Add an optional "title" attribute to the iframe in the vimeo shortcode. If one is not given, the title attribute will default to "vimeo video". It is imperative for iframes to have a non-empty "title" attribute in order to meet WCAG2.0 accessibility guidelines https://www.w3.org/TR/WCAG20-TECHS/H64. --- docs/content/en/content-management/shortcodes.md | 4 ++-- hugolib/embedded_shortcodes_test.go | 16 +++++++++++++--- tpl/tplimpl/embedded/templates.autogen.go | 6 +++--- .../embedded/templates/shortcodes/vimeo.html | 6 +++--- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/content/en/content-management/shortcodes.md b/docs/content/en/content-management/shortcodes.md index 3be1c6f9..94966343 100644 --- a/docs/content/en/content-management/shortcodes.md +++ b/docs/content/en/content-management/shortcodes.md @@ -345,10 +345,10 @@ Using the preceding `vimeo` example, the following HTML will be added to your re {{< /output >}} {{% tip %}} -If you want to further customize the visual styling of the YouTube or Vimeo output, add a `class` named parameter when calling the shortcode. The new `class` will be added to the `
` that wraps the `.*?
\n", + "(?s)\n
.*?.*?
\n", }, // set class { `{{< vimeo 146022717 video >}}`, - "(?s)\n
.*?.*?
\n", + "(?s)\n
.*?.*?
\n", + }, + // set vimeo title + { + `{{< vimeo 146022717 video my-title >}}`, + "(?s)\n
.*?.*?
\n", }, // set class (using named params) { `{{< vimeo id="146022717" class="video" >}}`, - "(?s)^
.*?.*?
", + "(?s)^
.*?.*?
", + }, + // set vimeo title (using named params) + { + `{{< vimeo id="146022717" class="video" title="my vimeo video" >}}`, + "(?s)^
.*?.*?
", }, } { var ( diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index 50016764..2bdb56b5 100644 --- a/tpl/tplimpl/embedded/templates.autogen.go +++ b/tpl/tplimpl/embedded/templates.autogen.go @@ -466,10 +466,10 @@ if (!doNotTrack) { {{ template "_internal/shortcodes/vimeo_simple.html" . }} {{- else -}} {{ if .IsNamedParams }}
- +
{{ else }} -
- +
+
{{ end }} {{- end -}} diff --git a/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html b/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html index 94f03470..1680c169 100644 --- a/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html +++ b/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html @@ -4,10 +4,10 @@ {{ template "_internal/shortcodes/vimeo_simple.html" . }} {{- else -}} {{ if .IsNamedParams }}
- +
{{ else }} -
- +
+
{{ end }} {{- end -}} -- 2.30.2