mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-26 22:48:30 +02:00
Scope Learn search to learning resources
This commit is contained in:
@@ -5,9 +5,10 @@ import 'qdrant-page-search/dist/js/search.min.js';
|
||||
const metadata = document.querySelector('meta[name="partition"]');
|
||||
let partition = metadata ? metadata.content : null;
|
||||
|
||||
// Learn spans guides, articles, tutorials, and courses, regardless of URL.
|
||||
if (partition === 'learn' || /^\/learn(?:\/|$)/.test(window.location.pathname)) {
|
||||
window.initQdrantSearch({ searchApiUrl: 'https://search.qdrant.tech/api/search', section: 'articles,course,documentation' });
|
||||
// Tutorials span several partitions; use the Learn catalog's paths instead.
|
||||
const learnSections = document.querySelector('meta[name="learn-search-sections"]');
|
||||
if (learnSections) {
|
||||
window.initQdrantSearch({ searchApiUrl: 'https://search.qdrant.tech/api/search', section: learnSections.content });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,18 @@
|
||||
{{ if $partition }}
|
||||
<meta name="partition" content="{{ $partition | safeHTML }}" />
|
||||
{{ end }}
|
||||
{{ if eq $partition "learn" }}
|
||||
{{ $sections := slice "articles" "course" }}
|
||||
{{ range where (site.GetPage "/documentation").Sections "Params.learning_kind" "guides" }}
|
||||
{{ $sections = $sections | append (strings.TrimPrefix "/" (strings.TrimSuffix "/" .RelPermalink)) }}
|
||||
{{ end }}
|
||||
{{ range hugo.Data.examples }}
|
||||
{{ with site.GetPage .page }}
|
||||
{{ $sections = $sections | append (strings.TrimPrefix "/" (strings.TrimSuffix "/" .RelPermalink)) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<meta name="learn-search-sections" content="{{ delimit $sections "," }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ partial "css" . }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user