{%- if page %}
	{% set slug = page.slug %}
{%- else %}
	{% set slug = "" %}
{%- endif %}

<div id="docs">
	<ul>
	{%- for page in section.pages %}
		{%- if page.extra.section == 0 %}
			<li>
				<a class="{%- if slug == page.slug -%}active{%- endif -%}" href="{{ page.permalink | safe }}">{{ page.title }}</a>
			</li>
		{%- endif %}
	{%- endfor %}
	{%- for page_section, pages in section.pages | group_by(attribute="extra.section") %}
		{% set int_section = page_section | int %}
		{%- if int_section > 0 %}
			<h3>{{ section.extra.sections | nth(n=int_section - 1) }}</h3>
			{%- for page in pages %}
				<li>
					<a class="{%- if slug == page.slug -%}active{%- endif -%}" href="{{ page.permalink | safe }}">{{ page.title }}</a>
				</li>
			{%- endfor %}
		{%- endif %}
	{%- endfor %}
	</ul>
</div>
