File tree Expand file tree Collapse file tree 10 files changed +76
-20
lines changed
project_template/content/documentation Expand file tree Collapse file tree 10 files changed +76
-20
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,19 @@ The documentation content is written in Markdown with some custom shortcodes.
3636
3737### Page parameters (front matter)
3838
39+ #### Search index for documentation section
40+
41+ To generate ` documentation/search.json ` for offline search, add ` search ` to the outputs of the ` documentation/_index.* ` pages:
42+
43+ ``` yaml
44+ ---
45+ title : Deckhouse <PRODUCT_NAME>
46+ outputs :
47+ - HTML
48+ - search
49+ ---
50+ ```
51+
3952#### Related links
4053
4154``` yaml
Original file line number Diff line number Diff line change 1+ outputFormats :
2+ search :
3+ mediaType : application/json
4+ baseName : search
5+ isPlainText : true
6+ notAlternative : true
Original file line number Diff line number Diff line change @@ -78,9 +78,7 @@ platform: platform
7878required_value_sentence : Required value
7979related_additional_resources : Additional resources
8080reset_filter : reset filter
81- search_context_dkpdocs_and_modules : The search is performed throughout DKP documentation and modules.
82- search_context_modules : The search is performed throughout modules, excluding the DKP documentation.
83- search_context_only_product_docs : The search is performed throughout the product documentation, excluding modules.
81+ search_context_dkpdocs_and_modules : The search is performed across all documentation of the current product.
8482search_placeholder_text : Search...
8583section_list_title : Section contents
8684show_more : Show more
Original file line number Diff line number Diff line change @@ -78,9 +78,7 @@ platform: платформа
7878required_value_sentence : Обязательный параметр
7979related_additional_resources : Дополнительные ресурсы
8080reset_filter : Сбросить фильтр
81- search_context_dkpdocs_and_modules : Поиск выполняется по всей документации DKP и модулям.
82- search_context_modules : Поиск выполняется по всем модулям, не включая документацию DKP.
83- search_context_only_product_docs : Поиск выполняется по всей документации продукта, не включая модули.
81+ search_context_message : Поиск выполняется по всей документации текущего продукта.
8482search_placeholder_text : Поиск...
8583section_list_title : Содержание раздела
8684show_more : Показать ещё
Original file line number Diff line number Diff line change 1+ {{- $documents := slice - }}
2+ {{- range .RegularPagesRecursive - }}
3+ {{- if and (ne .Params.hidden true) (ne .Params.noindex true) - }}
4+ {{- $bc := slice - }}
5+ {{- $skipTopSection := true - }}
6+ {{- range .Ancestors.Reverse - }}
7+ {{- if .IsHome - }}
8+ {{- continue - }}
9+ {{- end - }}
10+ {{- if $skipTopSection - }}
11+ {{- $skipTopSection = false - }}
12+ {{- continue - }}
13+ {{- end - }}
14+ {{- $bc = $bc | append .LinkTitle - }}
15+ {{- end - }}
16+ {{- $documents = $documents | append (dict
17+ " title" .Title
18+ " url" .RelPermalink
19+ " keywords" .Params.keywords
20+ " bc" $bc
21+ " content" (.Plain | replaceRE "\\s+" " " | strings.TrimSpace)
22+ ) - }}
23+ {{- end - }}
24+ {{- end - }}
25+ {{- dict "documents" $documents "parameters" (slice) | jsonify - }}
Original file line number Diff line number Diff line change 11{{- $currentPage := . -}}
2-
2+ <!--noindex-->
33< div class ="sidebar__wrapper-inner ">
44 < nav class ="sidebar__container ">
55 < ul class ="sidebar " id ="mysidebar ">
1515 </ ul >
1616 </ nav >
1717</ div >
18+ <!--/noindex-->
1819
1920{{/* --- subpages --- */}}
2021{{- define "subpages" }}
Original file line number Diff line number Diff line change 33 $ ( document ) . ready ( function ( ) {
44 // Handler for .ready() called.
55
6+ function getHeaderHeight ( ) {
7+ const header = $ ( 'header' ) ;
8+ return header . outerHeight ( true ) ;
9+ }
10+
11+ const headerHeight = getHeaderHeight ( ) ;
12+ const $sidebar = $ ( '.sidebar__wrapper-inner' ) ;
13+ $sidebar . css ( "top" , headerHeight ) ;
14+ const $navigationContainer = $ ( '.navigation__container' ) ;
15+ $navigationContainer . css ( "top" , headerHeight ) ;
16+
617 const $toc = $ ( '#toc-sidebar' ) ;
718
819 $toc . toc ( {
Original file line number Diff line number Diff line change 1515
1616 < div class ="container ">
1717
18- < div class ="breadcrumbs-container ">
19- < div class ="breadcrumbs__left ">
20- < ol class ="breadcrumbs ">
21- <!-- <li class="breadcrumbs__item">{{ T "modules_documentation" | humanize }}</li>-->
22- </ ol >
18+ <!--noindex-->
19+ < div class ="navigation__container ">
20+ < div class ="navigation__container--versions "> </ div >
21+ < div class ="breadcrumbs__container ">
22+ < ol class ="breadcrumbs ">
23+ {{- partial "breadcrumbs" . }}
24+ </ ol >
2325 </ div >
24- < div class ="breadcrumbs__right ">
25- < ol class ="breadcrumbs ">
26- {{- partial "breadcrumbs" . }}
27- </ ol >
28- </ div >
29- {{ if .Params.search_enabled }}
26+ {{ if .Site.Params.offlineSearch }}
3027 <!--start search-->
3128 < div class ="searchV3 ">
3229 < div class ="container ">
3330 < div class ="input-wrapper ">
3431 < input type ="text " id ="search-input " placeholder ='{{ T "search_placeholder_text" }} ' class ="input "
35- data-search-index-path =" / search.json:1.0"
36- data-search-context ='{{ T "search_context_only_product_docs " }} '
32+ data-search-index-path =' {{ strings.TrimSuffix "/" (urls.Parse site.BaseURL).Path }}/documentation/ search.json:1.0'
33+ data-search-context ='{{ T "search_context_message " }} '
3734 >
3835 < div id ="search-results " class ="results " style ="display: none "> </ div >
3936 </ div >
4643 <!--end loading search JS-->
4744 {{ end }}
4845 </ div >
46+ <!--/noindex-->
4947
5048 < div class ="layout-sidebar ">
5149 < div class ="layout-sidebar__sidebar ">
Original file line number Diff line number Diff line change 11---
22title : Deckhouse <PRODUCT_NAME>
33weight : 1
4+ outputs :
5+ - HTML
6+ - search
47---
58
Original file line number Diff line number Diff line change 11---
22title : Deckhouse <PRODUCT_NAME>
33weight : 1
4+ outputs :
5+ - HTML
6+ - search
47---
58
You can’t perform that action at this time.
0 commit comments