{{/* Inline JavaScript to add version info to navbar */}}
{{ $buildInfo := .Site.Data.build_info }}
{{ if $buildInfo }}
<script>
document.addEventListener('DOMContentLoaded', function() {
  // Find the navbar container
  const navbarContainer = document.querySelector('.td-navbar .container-fluid');
  if (!navbarContainer) return;
  
  // Create version info element
  const versionDiv = document.createElement('div');
  versionDiv.className = 'navbar-version-info d-none d-md-flex align-items-center mx-3';
  versionDiv.style.flex = '1';
  versionDiv.style.justifyContent = 'center';
  
  const versionText = {{ if $buildInfo.git_tag }}"{{ $buildInfo.git_tag }}"{{ else }}"{{ $buildInfo.git_branch }}"{{ end }};
  const commitHash = "{{ $buildInfo.git_commit_short }}";
  const isDirty = {{ $buildInfo.git_dirty }};
  
  versionDiv.innerHTML = `
    <small class="text-light opacity-75">
      <span class="fw-bold">${versionText}</span>
      <span class="mx-1">@</span><code class="text-light bg-transparent border-0 p-0" style="font-size: 0.8rem;">${commitHash}</code>
      ${isDirty ? '<span class="badge bg-warning text-dark ms-1 px-1" style="font-size: 0.6rem;">*</span>' : ''}
    </small>
  `;
  
  // Insert version info between brand and nav items
  const navScroll = navbarContainer.querySelector('.td-navbar-nav-scroll');
  if (navScroll) {
    navbarContainer.insertBefore(versionDiv, navScroll);
  }
});
</script>
{{ end }}