{% extends "base.html" %} {% block content %} {% if page.nb_url %} {# Parse notebook path/URL #} {% set parts = page.nb_url.split('/') %} {% set tutorial_name = parts[-2] %} {% set filename = parts[-1] %} {# Colab url #} {% set base_colab_url = "https://colab.research.google.com/github/" %} {% set colab_url = base_colab_url ~ config.extra.vars.github_repository ~ "/blob/gh-pages/" ~ config.extra.vars.docs_version ~ "/tutorials/" ~ tutorial_name ~ "/" ~ filename %} {# Download link: relative to the current page #} {% set file_url = filename %} {# Open in Colab (absolute GitHub URL; works anywhere) #} {% include ".icons/google-colab.svg" %} {# Download: use a RELATIVE link to the file next to this page #} {% include ".icons/material/download.svg" %} {% endif %} {{ super() }} {% endblock content %}