Skip to content

Instantly share code, notes, and snippets.

@hobelinm
Last active February 24, 2024 23:21
Show Gist options
  • Save hobelinm/de089f99c3543e2a16f8f24fee4d958e to your computer and use it in GitHub Desktop.
Save hobelinm/de089f99c3543e2a16f8f24fee4d958e to your computer and use it in GitHub Desktop.
Hugo shortcode to embed Tableau Vizzes
{{/* Featured on: */}}
{{/* https://brewingcats.com/posts/projects/software/tableauparser/ */}}
{{/* https://brewingcats.com/es/posts/projects/software/tableauparser/ */}}
{{/* tableau "viz_id" "view_pre" "view_id" "view_name" */}}
<div class='tableauPlaceholder' id='{{.Get 0 }}' style='position: relative'>
<noscript>
<a href='#'>
<img alt=' '
src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;{{.Get 1 }}&#47;{{.Get 2 }}&#47;{{.Get 3 }}&#47;1_rss.png'
style='border: none' />
</a>
</noscript>
<object class='tableauViz' style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='embed_code_version' value='3' />
<param name='site_root' value='' />
<param name='name' value='{{.Get 2 }}&#47;{{.Get 3 }}' />
<param name='tabs' value='no' />
<param name='toolbar' value='yes' />
<param name='static_image'
value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;{{.Get 1 }}&#47;{{.Get 2 }}&#47;{{.Get 3 }}&#47;1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
</object>
</div>
<script type='text/javascript'>
var divElement = document.getElementById('{{.Get 0 }}');
var vizElement = divElement.getElementsByTagName('object')[0];
vizElement.style.width='1024px';vizElement.style.height='795px';
var scriptElement = document.createElement('script');
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';
vizElement.parentNode.insertBefore(scriptElement, vizElement);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment