Skip to content

Commit 00716c9

Browse files
committed
WIP: Enable DocSearch powered by Algolia
1 parent 6d3c097 commit 00716c9

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

app/assets/stylesheets/custom.scss

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,27 @@
33

44
// Customized by YassLab
55

6-
/*改行位置の調整*/
7-
.ignore-pc{
8-
display:none;
9-
}
10-
.ignore-sp{
11-
display:inline;
12-
}
6+
/* DocSearch by Algolia */
7+
body {
8+
font-family: sans-serif;
9+
padding: 1em;
10+
}
11+
.ais-SearchBox { margin: 1em 0; }
12+
13+
/* 改行位置の調整 */
14+
.ignore-pc{
15+
displayplay:none;
16+
}
17+
.ignore-sp{
18+
display:inline;
19+
}
1320

1421
@media screen and (max-width: 640px) {
1522
.ignore-pc{
16-
display:inline;
23+
display:inline;
1724
}
1825
.ignore-sp{
19-
display:none;
26+
display:none;
2027
}
2128
}
2229

app/views/home/show.html.haml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
が制作した動画です。道場の雰囲気が伝われば幸いです ;)
4646
= render partial: 'shared/sns'
4747

48+
.ais-InstantSearch
49+
.right-panel
50+
%input#searchbox
51+
#hits
52+
#pagination
53+
54+
4855
/
4956
%section#events.detail-introduction.text-center
5057
%h2 直近のイベント

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) {

0 commit comments

Comments
 (0)