diff --git a/assets/js/search.js b/assets/js/search.js index d95dba3af..c3e7adbca 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -166,7 +166,7 @@ function executeQuery(term) {
${title}
-
${value.item.section}·${value.item.date}
+
${value.item.section}·${value.item.date? value.item.date : ""}
${value.item.summary}
diff --git a/layouts/_default/index.json b/layouts/_default/index.json index 7fbcfe26b..b301c8d68 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -5,7 +5,8 @@ {{ end }} {{- range $pages -}} {{- $section := .Site.GetPage "section" .Section -}} - {{- $index = $index | append (dict + {{- if .Date -}} + {{- $index = $index | append (dict "date" (.Date | time.Format (.Site.Language.Params.dateFormat | default ":date_long")) "title" (.Title | emojify | safeJS) "section" ($section.Title | emojify | safeJS) @@ -14,6 +15,17 @@ "permalink" .RelPermalink "externalUrl" .Params.externalUrl "type" .Type - ) -}} + ) -}} + {{- else -}} + {{- $index = $index | append (dict + "title" (.Title | emojify | safeJS) + "section" ($section.Title | emojify | safeJS) + "summary" (.Summary | safeJS) + "content" (.Plain | safeJS) + "permalink" .RelPermalink + "externalUrl" .Params.externalUrl + "type" .Type + ) -}} + {{- end -}} {{- end -}} {{- $index | jsonify -}} \ No newline at end of file