Repository navigation
Conversation
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
yada
left a comment
There was a problem hiding this comment.
The jsonify approach fixes the fragile delimiter handling, but the final commit introduces a search-index regression. Moving the section-expansion block outside .Pages.GroupBy "Section" and checking $.Section means it never executes for the homepage.
The generated index drops from 174 entries to 9, removing all Author, Blog, and Documentation results. Please keep that block inside the inner page loop, using the current page’s .Section and .Title, then serialize the accumulated entries with jsonify. A test should also parse index.json and verify representative documentation and blog URLs remain indexed.
Last but not least, the PR should be revised into a Hugo-native, test-covered solution before merging:
- Use a local newScratch instead of deprecated page-level $.Scratch.
- Add a build test that parses public/index.json and checks representative Blog and Documentation URLs.
- Either centralize the shared logic in a partial or confirm whether the duplicate documentation template is still needed.
|
I think this needs to be tested and verified locally to avoid previous consequences (c9ed769). |
…o fixing-comma-handling
|
@aniket866 any news regarding the requested change? Thanks |
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
|
@yada I have done the requested changes , sorry for the delay , let me know any more changes required , I will be doing that actively.
|

Closes #556
Describe the bug
Description
The search index layout file manually prints braces, quotes, keys, and values to build
index.json, but fails to place commas between items in the page range loop, or prints trailing commas when pages are excluded.}{{- if eq $item $len -}}{{- else -}},{{- end -}}Why It Breaks
Without proper comma delimiters between items in the inner loop, the result is malformed JSON. Furthermore, if a page is excluded (e.g.,
ignoreSearch: true), the hardcoded comma rendering logic results in trailing commas (e.g.[ { ... }, ]) or consecutive commas (e.g.,,,). This causesJSON.parse()to throw a syntax error in the browser and completely breaks the search capability.How to Reproduce
ignoreSearch = truein frontmatter.hugo.public/index.jsonand validate it using a JSON validator (likeJSON.parse()in Node.js).