This is an automated email from the ASF dual-hosted git repository.

dannycranmer pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/flink-web.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 1c421652b [FLINK-33043][docs] Fix website search feature
1c421652b is described below

commit 1c421652b337f4be943d0f0a07de535318cb2a1a
Author: Danny Cranmer <[email protected]>
AuthorDate: Wed Sep 6 09:52:18 2023 +0100

    [FLINK-33043][docs] Fix website search feature
---
 docs/assets/search-data.js | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/docs/assets/search-data.js b/docs/assets/search-data.js
index 620fc380c..4470152db 100644
--- a/docs/assets/search-data.js
+++ b/docs/assets/search-data.js
@@ -36,15 +36,20 @@
 
   {{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
   {{- $pages = where $pages "Params.booksearchexclude" "!=" true -}}
-  {{- $pages = where $pages "Content" "not in" (slice nil "") -}}
 
-  {{ range $index, $page := $pages }}
-  index.add({
-    'id': {{ $index }},
-    'href': '{{ $page.RelPermalink }}',
-    'title': {{ (partial "docs/simple-title" $page) | jsonify }},
-    'section': {{ (partial "docs/simple-title" $page.Parent) | jsonify }},
-    'content': {{ $page.Plain | jsonify }}
-  });
+  {{ $.Scratch.Set "counter" 0 }}
+  {{ range $page := $pages }}
+    {{ if ne $page.Plain "" }}
+      {{ if ne $page.Plain nil }}
+        index.add({
+          'id': {{$.Scratch.Get "counter"}},
+          'href': '{{ $page.RelPermalink }}',
+          'title': {{ (partial "docs/simple-title" $page) | jsonify }},
+          'section': {{ (partial "docs/simple-title" $page.Parent) | jsonify 
}},
+          'content': {{ $page.Plain | jsonify }}
+        });
+        {{ $.Scratch.Add "counter" 1 }}
+      {{ end }}
+    {{ end }}
   {{- end -}}
 })();

Reply via email to