{% set edit_base = site.config.extra.edit_url_base | default(value="") %}
{% if edit_base %}
{% set source_path = post.frontmatter.extra.source_path | default(value="content/posts/" ~ post.slug ~ ".md") %}
<p class="text-sm text-gray-500 dark:text-gray-400 mt-6">
    <a href="{{ edit_base | safe }}/{{ source_path | safe }}" target="_blank" rel="noopener noreferrer" class="inline-flex items-center gap-2 hover:text-blue-500 dark:hover:text-blue-400 transition-colors">
        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
        </svg>
        Edit this post on GitHub
    </a>
</p>
{% endif %}
