{% macro render_main_menu() -%}

{# Set menu item selected if the current resource matches the item in the
   site's config file or set "Advanced topics" selected for any resources
   that have the "advanced" folder as their parent.
#}
<ul>
{% for menu_item in menu -%}
    <li><a {% if (menu_item.url == resource.url) or
                 (menu_item.title == "Advanced topics"
                  and resource.node.name == "advanced")
            %}class="selected"{% endif -%}
            href="{{ content_url(menu_item.url) }}">{{ menu_item.title }}</a></li>
{%- endfor %}
</ul>
{%- endmacro %}


{# Advanced topics macro. Renders navigation at the end of the article. #}

{% macro render_bottom_article_nav() %}
<div class="bottom_article_nav">
{% if resource.next_by_index is not none -%}
    <div class="next"><a href="{{ resource.next_by_index.full_url }}">
    {{ resource.next_by_index.meta.title_ending|replace("| ", "") }}</a>
    &gt;</div>
{%- endif %}

{% if resource.prev_by_index is not none -%}
    <div class="prev">&lt; <a href="{{ resource.prev_by_index.full_url }}">
    {{ resource.prev_by_index.meta.title_ending|replace("| ", "") }}</a>
    </div>
{%- endif %}
</div>
{% endmacro %}
