{%- if script.path %} {# Detected MkDocs 1.5+ which has `script.path` and `script_tag` #} {{ script | script_tag }} {%- else %} {# Fallback - examine the file name directly #} {% if script.endswith('.mjs') %} {% else %} {% endif %} {%- endif %}