Skip to content

Commit 7a81b43

Browse files
committed
🔍 Enable DocSearch in Kata (powered by Algolia)
1 parent 6d3c097 commit 7a81b43

File tree

4 files changed

+71
-11
lines changed

4 files changed

+71
-11
lines changed

app/assets/stylesheets/clean-blog.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ hr.small {
8383
}
8484
.navbar-custom .nav li a {
8585
color: white;
86-
padding: 20px;
86+
padding: 20px 15px;
8787
}
8888
.navbar-custom .nav li a:hover,
8989
.navbar-custom .nav li a:focus {

app/assets/stylesheets/custom.scss

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
11
@import "bootstrap-sprockets";
22
@import "bootstrap";
33

4-
// Customized by YassLab
4+
// Customized by YassLab team
55

6-
/*改行位置の調整*/
7-
.ignore-pc{
8-
display:none;
9-
}
10-
.ignore-sp{
11-
display:inline;
12-
}
6+
/* DocSearch by Algolia */
7+
.search {
8+
padding-top: 17px;
9+
padding-left: 15px;
10+
padding-bottom: 10px;
11+
}
12+
#searchbox {
13+
padding-left: 5px;
14+
font-size: 90%;
15+
}
16+
.algolia-autocomplete {
17+
/* Main dropdown wrapper */
18+
// max-width: 100px;
19+
}
20+
.algolia-autocomplete .ds-dropdown-menu {
21+
// width: 200px;
22+
}
23+
.algolia-autocomplete .algolia-docsearch-suggestion--category-header {
24+
/* Main category (eg. Getting Started) */
25+
// color: darkgray;
26+
// border: 1px solid gray;
27+
}
28+
.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column {
29+
/* Category (eg. Downloads) */
30+
// color: gray;
31+
}
32+
.algolia-autocomplete .algolia-docsearch-suggestion--title {
33+
/* Title (eg. Bootstrap CDN) */
34+
// font-weight: bold;
35+
// color: black;
36+
}
37+
.algolia-autocomplete .algolia-docsearch-suggestion--text {
38+
/* Description description (eg. Bootstrap currently works...) */
39+
// font-size: 0.8rem;
40+
// color: gray;
41+
}
42+
.algolia-autocomplete .algolia-docsearch-suggestion--highlight {
43+
/* Highlighted text */
44+
// color: blue;
45+
}
46+
47+
/* 改行位置の調整 */
48+
.ignore-pc{
49+
displayplay:none;
50+
}
51+
.ignore-sp{
52+
display:inline;
53+
}
1354

1455
@media screen and (max-width: 640px) {
1556
.ignore-pc{
16-
display:inline;
57+
display:inline;
1758
}
1859
.ignore-sp{
19-
display:none;
60+
display:none;
2061
}
2162
}
2263

app/views/layouts/application.html.haml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,27 @@
5454
/[if lt IE 9]
5555
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
5656
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
57+
58+
/ at the end of the HEAD
59+
%link{:href => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css", :rel => "stylesheet"}/
60+
5761
%body
5862
- flash.each do |message_type, message|
5963
%div{:class => "alert alert-#{message_type}"}= message
6064
= yield
6165
= scrivito_body_tags if using_scrivito?
6266
= render 'shared/footer'
67+
/ at the end of the BODY
68+
%script{:src => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js",
69+
:type => "text/javascript"}
70+
:javascript
71+
docsearch({
72+
apiKey: '315da3c406c3fa374a0696590f4821a3',
73+
indexName: 'coderdojo',
74+
inputSelector: '#searchbox',
75+
debug: false // Set debug to true if you want to inspect the dropdown
76+
});
77+
6378
#fb-root
6479
:javascript
6580
(function(d, s, id) {

app/views/plain_page/index.html.haml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
/ Collect the nav links, forms, and other content for toggling
1414
#bs-example-navbar-collapse-1.collapse.navbar-collapse
1515
%ul.nav.navbar-nav.navbar-right
16+
%li.search
17+
%input#searchbox{ :placeholder => "🔍 検索", :type => "text" }
18+
#hits
19+
#pagination
1620
%li
1721
%a{:href => "#README"} はじめに
1822
%li

0 commit comments

Comments
 (0)