From 29cfb4b7b5787d32c915843c3fdc1200bca9284e Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 12 Jun 2024 13:57:39 -0300 Subject: content: generateCommentarySection: blank if no entries --- src/content/dependencies/generateCommentarySection.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/generateCommentarySection.js b/src/content/dependencies/generateCommentarySection.js index 39727360..c5090660 100644 --- a/src/content/dependencies/generateCommentarySection.js +++ b/src/content/dependencies/generateCommentarySection.js @@ -1,3 +1,5 @@ +import {empty} from '#sugar'; + export default { contentDependencies: [ 'transformContent', @@ -12,15 +14,17 @@ export default { relation('generateContentHeading'), entries: - entries.map(entry => - relation('generateCommentaryEntry', entry)), + (entries + ? entries.map(entry => + relation('generateCommentaryEntry', entry)) + : []), }), data: (entries) => ({ firstEntryIsDated: - (entries[0] - ? !!entries[0].date - : null), + (empty(entries) + ? null + : !!entries[0].date), }), generate: (data, relations, {html, language}) => -- cgit 1.3.0-6-gf8a5