<% tags_count = site.tags_dataset.count %>
<% show_tags = (!is_current_site && tags_count > 0) || is_current_site %>
<% edit_tags_path = "/settings/#{site.username}#tags" %>

<% if show_tags %>
  <h3>
    Tags
    <% if is_current_site %>
      <small style="font-size: 60%; font-weight: normal">
        <a href="<%= edit_tags_path %>">Edit</a>
      </small>
    <% end %>
  </h3>

  <% if tags_count.zero? %>
    <% if is_current_site %>
      <p>You don't have any tags yet. <a href="<%= edit_tags_path %>">Add some from your site settings</a>.</p>
    <% else %>
      <p>This site hasn't added any tags yet.</p>
    <% end %>
  <% else %>
    <% site.tags.each do |tag| %>
      <a class="tag" href="/browse?tag=<%== Rack::Utils.escape tag.name %>"><%= tag.name %></a>
    <% end %>
  <% end %>
<% end %>
