diff --git a/_config.yml b/_config.yml index 58d048a0c96dc43ade617d4a7a3f9a5a933d7e87..22aef3f2a2b3976a33067589eb55e87472407c3a 100644 --- a/_config.yml +++ b/_config.yml @@ -21,6 +21,9 @@ baseurl: "/just-the-docs/" # the subpath of your site, e.g. /blog permalink: pretty exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"] +# Enable or disable the site search +search_enabled: true + # Aux links for the upper right navigation aux_links: "Just the Docs on GitHub": diff --git a/_includes/head.html b/_includes/head.html index 8aae2cf99de1a2f95c100ef30a8e143b44e4713a..cbd41f9d3cd65937ded1b7e991001730b4ac19a2 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -4,7 +4,9 @@ <title>{{ page.title }} - {{ site.title }}</title> <link rel="stylesheet" href="{{ "/assets/css/just-the-docs.css" | absolute_url }}"> + {% if site.search_enabled != nil %} <script type="text/javascript" src="{{ "/assets/js/vendor/lunr.min.js" | absolute_url }}"></script> + {% endif %} <script type="text/javascript" src="{{ "/assets/js/just-the-docs.js" | absolute_url }}"></script> <meta name="viewport" content="width=device-width, initial-scale=1"> diff --git a/_layouts/default.html b/_layouts/default.html index fe76346d43c23b502f7105483d0b91ac1b256caf..cc7678631dbaf3c5c8160fb4ab1e4809f661849e 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -16,7 +16,8 @@ </div> <div class="main-content-wrap"> <div class="page-header"> - <div class="main-content pb-0"> + <div class="main-content"> + {% if site.search_enabled != nil %} <div class="search js-search"> <div class="search-input-wrap"> <input type="text" class="js-search-input search-input" placeholder="Search {{ site.title }}" aria-label="Search {{ site.title }}" autocomplete="off"> @@ -24,8 +25,9 @@ </div> <div class="js-search-results search-results-wrap"></div> </div> + {% endif %} {% if site.aux_links != nil %} - <ul class="list-style-none text-small mt-md-2 pb-4 pb-md-0 js-aux-nav aux-nav"> + <ul class="list-style-none text-small mt-md-1 mb-md-1 pb-4 pb-md-0 js-aux-nav aux-nav"> {% for link in site.aux_links %} <li class="d-inline-block my-0{% unless forloop.last %} mr-2{% endunless %}"><a href="{{ link.last }}">{{ link.first }}</a></li> {% endfor %} diff --git a/_sass/layout.scss b/_sass/layout.scss index e3c93e480b562f568863fb249e41393d7d91338a..35b9631b0e897244058c7961e19f5368b1d26431 100644 --- a/_sass/layout.scss +++ b/_sass/layout.scss @@ -79,8 +79,6 @@ @include mq(md) { background-color: $white; - border-bottom: $border $border-color; - } .main-content { @@ -88,8 +86,11 @@ @include mq(md) { display: flex; - justify-content: space-between; + justify-content: flex-end; + height: 60px; padding-top: $sp-4; + padding-bottom: $sp-4; + border-bottom: $border $border-color; } } } diff --git a/_sass/navigation.scss b/_sass/navigation.scss index 0c7925cd694027448e2deb60becca166e7f88883..e5d580b02ac7553e32e3128047520926e27ce9e9 100644 --- a/_sass/navigation.scss +++ b/_sass/navigation.scss @@ -14,7 +14,7 @@ z-index: 101; height: 60px; padding-top: $sp-4; - box-shadow: inset 0 -1px 0 $border-color; + border-bottom: $border $border-color; } } diff --git a/_sass/search.scss b/_sass/search.scss index 7037080661b29ecb2b12377dd9f639e4fbd58fcc..7e3a80267faf0f8ce967f996e860f22d88651620 100644 --- a/_sass/search.scss +++ b/_sass/search.scss @@ -17,7 +17,7 @@ display: block; padding-top: $sp-1; padding-right: 0; - padding-bottom: $sp-4; + padding-bottom: 0; padding-left: 0; margin-bottom: 0; background-color: transparent; diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js index dd24cfc854e25a5c37e96ffecc849539a524f24e..3c0a1b5574f3c94fc4648158b75ff2921d8adacf 100644 --- a/assets/js/just-the-docs.js +++ b/assets/js/just-the-docs.js @@ -155,7 +155,9 @@ function initSearch() { function ready(){ toggleNav(); - initSearch(); + if (typeof lunr !== 'undefined') { + initSearch(); + } } // in case the document is already rendered