Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions layouts/_default/list.search.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,30 @@
{{ $.Scratch.Add "algoliaindex" slice }}
{{ $section := $.Site.GetPage "section" .Section }}
{{ $hugo_context := . }}
{{ $apiPagesWithoutTypeAPI := slice "api/latest/" "api/latest/rate-limits/" "api/latest/scopes/" }}

{{ range (where (where (where .Site.AllPages "Kind" "!=" "home") "Type" "!=" "api") ".RelPermalink" "not in" $apiPagesWithoutTypeAPI) }}
{{- /*
Static API pages live under /api/ and carry `type: api`, but they have real markdown
bodies that should be indexed alongside other documentation. Paths are listed without
a language prefix; we strip the lang segment before comparing so all 5 languages match.
Auto-generated API tag/endpoint pages keep being indexed by api-pages-full-index.json.
*/ -}}
{{ $apiStaticPages := slice
"/api/latest/"
"/api/latest/using-the-api/"
"/api/latest/rate-limits/"
"/api/latest/scopes/" }}

{{ range (where .Site.AllPages "Kind" "!=" "home") }}
{{ $page := . }}
{{ if and ($page.IsDescendant $section) (ne $page.Params.type "partners") (ne $page.Params.private true) (not (in $page.RelPermalink "/faq")) (not $page.Draft) (not (isset .Params "external_redirect")) }}

{{- /* Strip /<lang>/ so non-English pages match the allow-list entries. */ -}}
{{ $comparePath := $page.RelPermalink }}
{{ if ne $page.Language.Lang "en" }}
{{ $comparePath = strings.TrimPrefix (printf "/%s" $page.Language.Lang) $comparePath }}
{{ end }}
{{ $isApiStatic := in $apiStaticPages $comparePath }}

{{ if and (or (ne $page.Type "api") $isApiStatic) ($page.IsDescendant $section) (ne $page.Params.type "partners") (ne $page.Params.private true) (not (in $page.RelPermalink "/faq")) (not $page.Draft) (not (isset .Params "external_redirect")) }}
{{- /* Generate unique ID for each page. Use file path when available, fallback to RelPermalink for pages without files (e.g. virtual pages). This avoids duplicate IDs while preserving existing IDs for 300k+ items. */ -}}
{{ $rel_path := "" }}
{{ with $page.File }}
Expand Down
Loading