Repository: cordova-docs Updated Branches: refs/heads/master 345b316d2 -> c7bcd83d8
CB-11104: Integrate Algolia Search to cordova docs. This closes #581. Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/c7bcd83d Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/c7bcd83d Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/c7bcd83d Branch: refs/heads/master Commit: c7bcd83d8a3efb2b01f32744f05786829bb710e7 Parents: 345b316 Author: Sarangan Rajamanickam <saraj...@microsoft.com> Authored: Mon Apr 18 12:19:05 2016 -0700 Committer: Raghav Katyal <rakat...@microsoft.com> Committed: Tue Apr 26 13:36:21 2016 -0700 ---------------------------------------------------------------------- conf/_config.yml | 2 ++ www/_includes/algolia.html | 21 +++++++++++++++++++++ www/_includes/head.html | 2 ++ www/_includes/header.html | 23 ++++++++++++----------- www/_layouts/base.html | 1 + www/static/css-src/main.scss | 27 +++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c7bcd83d/conf/_config.yml ---------------------------------------------------------------------- diff --git a/conf/_config.yml b/conf/_config.yml index 181ea36..7bbcc41 100644 --- a/conf/_config.yml +++ b/conf/_config.yml @@ -78,3 +78,5 @@ kramdown: # exclude these directories from the build exclude: - static/css-src + +algolia_api_key: "0a916ab198bd93d031aa70611271e42e" http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c7bcd83d/www/_includes/algolia.html ---------------------------------------------------------------------- diff --git a/www/_includes/algolia.html b/www/_includes/algolia.html new file mode 100644 index 0000000..c4db0e8 --- /dev/null +++ b/www/_includes/algolia.html @@ -0,0 +1,21 @@ +{% if page.version %} + {% assign version = page.version %} +{% else %} + {% assign version = site.latest_docs_version %} +{% endif %} + +{% if page.language %} + {% assign language = page.language %} +{% else %} + {% assign language = site.language %} +{% endif %} + +<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script> +<script type="text/javascript"> + docsearch({ + apiKey: '{{ site.algolia_api_key }}', + indexName: 'cordova', + inputSelector: '#header-search-field', + algoliaOptions: { 'facetFilters': ["version: {{ version }}", "language: {{ language }}"] } + }); +</script> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c7bcd83d/www/_includes/head.html ---------------------------------------------------------------------- diff --git a/www/_includes/head.html b/www/_includes/head.html index 2e34e5a..3332eda 100644 --- a/www/_includes/head.html +++ b/www/_includes/head.html @@ -24,6 +24,8 @@ <!-- CSS --> <link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/static/css/main.css"> <link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/static/css/lib/syntax.css"> + <!-- Algolia Search CSS --> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" /> <!-- Fonts --> <!-- For attribution information, see www/attributions.html --> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c7bcd83d/www/_includes/header.html ---------------------------------------------------------------------- diff --git a/www/_includes/header.html b/www/_includes/header.html index 4f63f82..9b3f16a 100644 --- a/www/_includes/header.html +++ b/www/_includes/header.html @@ -29,18 +29,19 @@ <li> <a href="{{ site.baseurl }}/#getstarted">Get Started</a> </li> + <li> + <form class="navbar-form navbar-right" id="header-search-form" role="search"> + <div class="input-group"> + {% if page.version %} + {% assign version = page.version %} + {% else %} + {% assign version = site.latest_docs_version %} + {% endif %} + <input id="header-search-field" type="text" placeholder="Search '{{ version }}' docs..." class="form-control hidden-xs" autocomplete="off"> + </div> + </form> + </li> </ul> - <form action="https://www.google.com/search" method="GET" class="navbar-form navbar-right" id="header-search-form" role="search"> - <div class="input-group"> - <input type="text" name="q" class="form-control hidden-sm" placeholder="Site-wide Search"> - <span class="input-group-btn"> - <button type="submit" class="btn search-button"> - <span class="glyphicon glyphicon-search" aria-hidden="true"></span> - </button> - </span> - </div> - <input type="hidden" name="q" value="site:cordova.apache.org"> - </form> </div> </div><!--/.navbar-collapse --> </div> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c7bcd83d/www/_layouts/base.html ---------------------------------------------------------------------- diff --git a/www/_layouts/base.html b/www/_layouts/base.html index c1342cb..a3412f4 100644 --- a/www/_layouts/base.html +++ b/www/_layouts/base.html @@ -10,5 +10,6 @@ analytics_id: UA-64283057-3 {% include analytics.html %} <script defer type="text/javascript" src="{{ site.baseurl }}/static/js/index.js"></script> <script defer type="text/javascript" src="{{ site.baseurl }}/static/js/twitter.js"></script> + {% include algolia.html %} </body> </html> http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c7bcd83d/www/static/css-src/main.scss ---------------------------------------------------------------------- diff --git a/www/static/css-src/main.scss b/www/static/css-src/main.scss index 9cf25c5..aeab6af 100644 --- a/www/static/css-src/main.scss +++ b/www/static/css-src/main.scss @@ -194,6 +194,33 @@ code { color: #000000; } +/* algolia search formatting */ +.algolia-docsearch-suggestion--category-header, .algolia-docsearch-suggestion { + font-family: "Raleway", Helvetica, Arial, sans-serif !important; +} + +.algolia-docsearch-suggestion--category-header { + background-color: #262626 !important; + font-size: 16px !important; + font-weight: bold !important; + line-height: 30px !important; +} + +.algolia-docsearch-suggestion { + font-size: 14px !important; + font-weight: 300 !important; +} + +@media (max-width: $screen-xs-max) { + #header-search-form { + display: none; + } +} + +#header-search-field { + border-radius: 4px !important; +} + @import 'home'; @import 'blog'; @import 'plugins'; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org