{% extends 'entity/page.html.j2' %}
{% set place = place | default(entity) %}
{% set page_title = place.names | negotiate_localizeds %}
{% block page_content %}
    {% include 'entity/meta--place.html.j2' %}

    {% set places = place.walk_encloses | map(attribute='encloses') | select('entity', 'place') | list %}
    {% if place.coordinates %}
        {% set places = places + [place] %}
    {% endif %}
    {% if places | length > 0 %}
        <section id="places">
            <h2 class="js-visually-hidden">
                {% trans %}Places{% endtrans %}
                {% with url = page_resource | url ~ '#places'%}
                    {% include 'permalink.html.j2' %}
                {% endwith %}
            </h2>
            {% with entity_contexts=entity_contexts(place), map_hides_list=True %}
                {% include 'entity/list--place.html.j2' %}
            {% endwith %}
        </section>
    {% endif %}

    {% if 'wikipedia' in project.extensions %}
        <section id="wikipedia">
            <h2 class="visually-hidden">
                {% trans %}Wikipedia{% endtrans %}
                {% with url = page_resource | url ~ '#wikipedia'%}
                    {% include 'permalink.html.j2' %}
                {% endwith %}
            </h2>
            {% with resource=place %}
                {% include 'wikipedia.html.j2' %}
            {% endwith %}
        </section>
    {% endif %}

    {% with notes = place.notes %}
        {% include 'section-notes.html.j2' %}
    {% endwith %}

    {% set events = (places + [place]) | unique | map(attribute='events') | flatten | select('public') | rejectattr('date', 'none') | selectattr('date.comparable') | list %}
    {% include 'timeline.html.j2' %}

    {% with file_references = place | associated_file_references %}
        {% include 'media.html.j2' %}
    {% endwith %}
{% endblock %}