From 472000faf5259648d1c7ec3ecfcbdf03b3e8de97 Mon Sep 17 00:00:00 2001 From: Kem Chen Date: Tue, 8 Aug 2023 09:39:48 +0800 Subject: [PATCH] Load comments.js on demand --- layout/_scripts/index.njk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layout/_scripts/index.njk b/layout/_scripts/index.njk index 6a3788b86..378cb369c 100644 --- a/layout/_scripts/index.njk +++ b/layout/_scripts/index.njk @@ -1,6 +1,8 @@ {%- include 'vendors.njk' -%} -{{- next_js('comments.js') }} +{%- if theme.injects.comment.length > 0 %} + {{- next_js('comments.js') }} +{%- endif %} {{- next_js('utils.js') }} {%- if theme.motion.enable %}