diff --git a/assets/js/search.js b/assets/js/search.js index 8e331fa5..e5f88047 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -140,7 +140,7 @@ function executeQuery(term) {
${value.item.title}
-
${value.item.section}·${value.item.date}
+
${value.item.section}${value.item.date == null ? '' : `·${value.item.date}`}
${value.item.summary}
diff --git a/layouts/_default/index.json b/layouts/_default/index.json index d431d3d7..20e328a4 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -1,8 +1,9 @@ {{- $index := slice -}} {{- range .Site.Pages -}} {{- $section := .Site.GetPage "section" .Section -}} + {{- $showDate := .Params.showDate | default .Site.Params.article.showDate -}} {{- $index = $index | append (dict - "date" (.Date | time.Format (.Site.Language.Params.dateFormat | default ":date_long")) + "date" (cond (and .IsPage $showDate) (.Date | time.Format (.Site.Language.Params.dateFormat | default ":date_long")) nil) "title" (.Title | emojify | safeJS) "section" ($section.Title | emojify | safeJS) "summary" (.Summary | emojify | safeJS)