{% for result in archiveresults %}
{% with display_path=result.path display_url='' preview_url='' %}
{% if display_path %}{% snapshot_url snapshot display_path as display_url %}{% endif %}
{% if display_path %}{% snapshot_preview_url snapshot display_path as preview_url %}{% endif %}
{% endif %}
{% if result.result %}
{% with plugin_base=result.name|plugin_name %}
{% if plugin_base == 'ytdlp' or plugin_base == 'yt-dlp' or plugin_base == 'youtube-dl' %}
{% plugin_card result.result %}
{% endif %}
{% endwith %}
{% endif %}
{% if result.result and display_path %}
{% with plugin_base=result.name|plugin_name %}
{% if plugin_base != 'ytdlp' and plugin_base != 'yt-dlp' and plugin_base != 'youtube-dl' %}
{# Use plugin-specific card template when ArchiveResult is available #}
{% plugin_card result.result %}
{% else %}
{# YT-DLP renders its file list in the body #}
{% endif %}
{% endwith %}
{% elif result.is_metadata and display_path %}
{% if best_result.result %}
{% plugin_full best_result.result as best_result_full_html %}
{# Use plugin-specific fullscreen template when ArchiveResult is available #}
{% if best_result_full_html %}
{{ best_result_full_html }}
{% else %}
{% endif %}
{% else %}
{# Fall back to generic iframe #}
{% endif %}