{{ $type :=  .Get "type" | default "table" }}
{{ $scratch := newScratch }}

{{ if eq $type "table"}}
  {{ range .Site.Data.influxdb_urls.cloud.providers }}
    {{ $scratch.Set "title" .name }}
    {{ if not (in .name .short_name) }}
      {{ $scratch.Set "title" (print .name " (" .short_name ")")}}
    {{ end }}
    {{ $title := $scratch.Get "title" }}
    {{ $titleID := anchorize $title }}
    <h3 id="{{ $titleID }}">{{ $title }}</h3>
    <table>
      <thead>
        <th align="left">Region</th>
        <th align="left">Location</th>
        <th align="left">URL</th>
      </thead>
      {{ range .regions }}
        <tr>
          <td {{ if .status }}class="{{ .status }}"{{ end }}>{{ .name }}</td>
          <td>{{ .location }}</td>
          <td><a href="{{ .url }}">{{ .url }}</a></td>
        </tr>
      {{ end }}
    </table>
  {{ end }}
{{ else if eq $type "list" }}
  <ul>
  {{ range .Site.Data.influxdb_urls.cloud.providers }}
    {{ $scratch.Set "title" .name }}
    {{ if not (in .name .short_name) }}
      {{ $scratch.Set "title" (print .name " (" .short_name ")")}}
    {{ end }}
    {{ $title := $scratch.Get "title" }}
      <li><strong>{{ $title }}</strong>
        <ul>
          {{ range .regions }}
            <li {{ if .status }}class="{{ .status }}"{{ end }}>{{ .name }}</li>
          {{ end }}
        </ul>
      </li>
  {{ end }}
  </ul>
{{ end }}