Skip to content

Commit 4e36547

Browse files
committed
Do not load DocSearch unless Kata page
1 parent 4f72e51 commit 4e36547

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

app/helpers/application_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ def kata_description
3434
def using_scrivito?
3535
!@obj.nil?
3636
end
37+
38+
def is_kata?
39+
request.path.starts_with? "/kata"
40+
end
3741
end

app/views/layouts/application.html.haml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
5757

5858
/ at the end of the HEAD
59-
%link{:href => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css", :rel => "stylesheet"}/
59+
- if is_kata?
60+
%link{:href => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css", :rel => "stylesheet"} if is_kata?
6061

6162
%body
6263
- flash.each do |message_type, message|
@@ -65,15 +66,16 @@
6566
= scrivito_body_tags if using_scrivito?
6667
= render 'shared/footer'
6768
/ 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-
});
69+
- if is_kata?
70+
%script{:src => "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js",
71+
:type => "text/javascript"}
72+
:javascript
73+
docsearch({
74+
apiKey: '315da3c406c3fa374a0696590f4821a3',
75+
indexName: 'coderdojo',
76+
inputSelector: '#searchbox',
77+
debug: false // Set debug to true if you want to inspect the dropdown
78+
});
7779

7880
#fb-root
7981
:javascript

0 commit comments

Comments
 (0)