{% block sidebar %} {% set is_notebook_page = false %} {% set notebook_path = '' %} {% if pagename %} {# Specific exclusions for pages that aren't notebooks but match patterns #} {% if pagename == 'general/tutorial/QAOAtutorial/index' or pagename == 'general/tutorial/QAOAtutorial/Theoretical' %} {# This is not a notebook page #} {% set is_notebook_page = false %} {% elif pagename.startswith('general/tutorial') %} {% set is_notebook_page = true %} {% set path_parts = pagename.split('/') %} {% set filename = path_parts[-1] %} {# Create the path to the actual notebook file #} {% set notebook_path = pagename + '.ipynb' %} {% elif pagename.endswith('.ipynb') or '.ipynb_' in pagename %} {% set is_notebook_page = true %} {% set notebook_path = '_sources/' + pagename %} {% if not notebook_path.endswith('.ipynb') %} {% set notebook_path = notebook_path + '.ipynb' %} {% endif %} {% endif %} {% endif %} {% if is_notebook_page %}
Run it locally.
{% set filename = path_parts[-1] + '.ipynb' %} Download Jupyter Notebook