{% if ('examples' in pagename or 'demonstrator' in pagename) and not 'index' in pagename %}
<div class="tocsection onthispace pt-5 bp-3">
    <h5>Try online:</h5>
    {% if 'demonstrator' in pagename %}
    <a href="https://mybinder.org/v2/gh/mammos-project/mammos/latest?urlpath=lab/tree/examples/{{ pagename.split('/')[-1] }}.ipynb"  target="_blank" rel="noopener noreferrer">
    {% else %}
    <a href="https://mybinder.org/v2/gh/mammos-project/{{ pagename.split('/')[-2] }}/latest?urlpath=lab/tree/examples/{{ pagename.split('/')[-1] }}.ipynb" target="_blank" rel="noopener noreferrer">
    {% endif %}
        <img src={{ pathto('_static/badge-launch-binder.svg', 1) }}>
    </a>
    {% if 'demonstrator' in pagename %}
    <a href="https://notebooks.mpcdf.mpg.de/binder/v2/gl/mammos-project%2Fmammos/latest?urlpath=lab/tree/examples/{{ pagename.split('/')[-1] }}.ipynb"  target="_blank" rel="noopener noreferrer">
    {% else %}
    <a href="https://notebooks.mpcdf.mpg.de/binder/v2/gl/mammos-project%2F{{ pagename.split('/')[-2] }}/latest?urlpath=lab/tree/examples/{{ pagename.split('/')[-1] }}.ipynb" target="_blank" rel="noopener noreferrer">
    {% endif %}
        <img src={{ pathto('_static/badge-launch-binder2.svg', 1) }}>
    </a>
    <h5>Try locally:</h5>
    {% set notebook_source = pathto('_sources/' + pagename + '.ipynb', 1) -%}
    <a href="{{ notebook_source }}" download="{{ pagename.split('/')[-1]}}.ipynb">
        <img src={{ pathto('_static/badge-download-notebook.svg', 1) }}>
    </a>
</div>
{% endif %}
