mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
fix: load comments.js before Alpine in head (correct defer order)
Alpine CDN uses queueMicrotask to auto-start, which fires between defer scripts. comments.js must execute before Alpine so its alpine:init listener is registered before Alpine.start() runs. This is the Alpine-documented pattern: "Include [component scripts] before Alpine's core JS file."
This commit is contained in:
@@ -73,6 +73,8 @@
|
||||
</script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lite-youtube-embed@0.3.2/src/lite-yt-embed.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/lite-youtube-embed@0.3.2/src/lite-yt-embed.min.js" defer></script>
|
||||
{# Alpine.js components — MUST load before Alpine core (Alpine.data() registration via alpine:init) #}
|
||||
<script src="/js/comments.js?v={{ '/js/comments.js' | hash }}" defer></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/collapse@3.x.x/dist/cdn.min.js"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<style>[x-cloak] { display: none !important; }</style>
|
||||
@@ -440,8 +442,6 @@
|
||||
<script type="module" src="/js/filter-container.js"></script>
|
||||
{# Client-side webmention fetcher - supplements build-time cache with real-time data #}
|
||||
<script src="/js/webmentions.js?v={{ '/js/webmentions.js' | hash }}" defer></script>
|
||||
{# Client-side comments - IndieAuth login + comment submission #}
|
||||
<script src="/js/comments.js?v={{ '/js/comments.js' | hash }}" defer></script>
|
||||
{# Admin auth detection - shows dashboard link + FAB when logged in #}
|
||||
<script src="/js/admin.js?v={{ '/js/admin.js' | hash }}" defer></script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user