<!-- Unique ID for the tabs within the page -->
{{- $guid := printf "tabs-%d" .Ordinal -}}
<!-- Scratchpad register to specially handle the first element in the list -->
{{- .Scratch.Set "first" true -}}

<ul class="nav nav-tabs" id="{{- $guid -}}" role="tablist">
{{- range .Params -}}
<li class="nav-item">
  {{- $entry := lower . -}}
  <!-- Generate the IDs for the <a> and the <div> elements -->
  {{- $tabid := printf "%s-%s-tab" $guid $entry | anchorize -}}
  {{- $entryid := printf "%s-%s" $guid $entry | anchorize -}}
  <a onclick="ga('send', 'event', 'Tabs', 'Clicked', '{{ $.Page.Title }} - {{ $entryid }}');" class="nav-link{{ if eq ($.Scratch.Get "first") true }} active{{ end }}"
    id="{{ $tabid }}" data-toggle="tab" href="#{{ $entryid }}" role="tab"
    aria-controls="{{ $entryid }}" aria-selected="{{ $.Scratch.Get "first" }}">
    {{ . }}
  </a>
  <!-- Reset the scratchpad register, since we're done with the first parameter -->
  {{- if eq ($.Scratch.Get "first") true -}}{{- $.Scratch.Set "first" false -}}{{- end -}}
</li>
{{- end -}}
</ul>

<!-- Inner content - generated by codetab shortcode -->
<div class="tab-content" id="{{- $guid -}}-content">
{{ .Inner }}
</div>
