{% extends "pages/wiki/base.html" %}

{% block title %}Index by Tags{% endblock title %}

{% block content %}
<h4>Tags being used</h4>
{% if tags %}
	<table class="display wrap" width="100%" id=Tags>
		<thead>
			<tr>
				<th>Tag</th>
				<th>Number of Articles</th>
			</tr>
		</thead>
		<tbody>
			{% for tag, pages in tags|dictsort %}
				<tr>
					<td><a href="{{ url_for('wikitag', name=tag) }}">{{ tag }}</a></td>
					<td>{{ pages|length }}</td>
				</tr>
			{% endfor %}
		</tbody>
	</table>
{% else %}
	<p>There are no tags in use so far.</p>
{% endif %}

{% endblock content %}

{% block postscripts -%}
{{ super() }}
$(document).ready(function() {
	// DataTable
	$("#Tags").DataTable({
		dom: 'Bfrtip',
		buttons: [
			{
				extend: 'collection',
				text: 'Export',
				buttons: [ 'pdf', 'csv', 'copy', 'excel' ]
			}
		],
		scrollX: true,
		select: true
	});
});
{% endblock postscripts -%}
