diff --git a/layouts/_default/list.search.json b/layouts/_default/list.search.json index 54645fd3da9..90a7154221d 100644 --- a/layouts/_default/list.search.json +++ b/layouts/_default/list.search.json @@ -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 // 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 }}