mirror of
				https://github.com/imfing/hextra.git
				synced 2025-10-31 08:54:51 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			847 B
		
	
	
	
		
			JSON
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			847 B
		
	
	
	
		
			JSON
		
	
	
	
	
	
| {{/* FlexSearch Index Data */}}
 | |
| {{- $indexType := site.Params.search.flexsearch.index | default "content" -}}
 | |
| 
 | |
| {{- if not (in (slice "content" "summary" "heading" "title" ) $indexType) -}}
 | |
|   {{- errorf "unknown flexsearch index type: %s" $indexType -}}
 | |
| {{- end -}}
 | |
| 
 | |
| {{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
 | |
| {{- $pages = where $pages "Params.excludeSearch" "!=" true -}}
 | |
| {{- $pages = where $pages "Content" "!=" "" -}}
 | |
| 
 | |
| {{- $output := dict -}}
 | |
| 
 | |
| {{- range $index, $page := $pages -}}
 | |
|   {{- $pageTitle := $page.LinkTitle | default $page.File.BaseFileName -}}
 | |
|   {{- $pageLink := $page.RelPermalink -}}
 | |
|   {{- $data := partial "utils/fragments" (dict "context" $page "type" $indexType) -}}
 | |
|   {{- $output = $output | merge (dict $pageLink (dict "title" $pageTitle "data" $data)) -}}
 | |
| {{- end -}}
 | |
| 
 | |
| {{- $output | jsonify -}}
 | 
