Skip to content
This repository was archived by the owner on Mar 26, 2023. It is now read-only.

Commit 428ded6

Browse files
authored
[Search] move to duckduckgo. close #187 (#353)
- Use duckduckgo (#187) - Add search box to main page
1 parent d3a7ac1 commit 428ded6

File tree

3 files changed

+43
-85
lines changed

3 files changed

+43
-85
lines changed

_includes/search_box.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!--
2+
Sources:
3+
https://duckduckgo.com/search_box
4+
https://muffinresearch.co.uk/adding-a-duckduckgo-search-box-to-your-blog/
5+
-->
6+
7+
<div class="row">
8+
<div class="col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
9+
<form name="search" action="//duckduckgo.com/">
10+
<div class="form-group">
11+
<div class="input-group">
12+
<input type="search" class="form-control" placeholder="DuckDuckGo" name="q">
13+
<input type="hidden" value="swiftweekly.github.io" name="sites">
14+
<input type="hidden" value="1" name="kh">
15+
<input type="hidden" value="1" name="kn">
16+
<input type="hidden" value="1" name="kac">
17+
<input type="hidden" value="1" name="kc">
18+
<span class="input-group-btn"><button class="btn btn-default" type="submit">
19+
<i class="fa fa-search" aria-hidden="true"></i></button>
20+
</span>
21+
</div>
22+
</div>
23+
</form>
24+
</div>
25+
</div>

index.html

+16-10
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@
55

66
<div>
77

8-
<div class="row">
8+
<div class="row">
99
<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
1010
{% include hiatus.html %}
1111
</div>
12-
</div>
12+
</div>
13+
14+
<div class="row">
15+
<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2">
16+
{% include search_box.html %}
17+
</div>
18+
</div>
1319

14-
{% for post in site.posts %}
15-
<article class="post">
16-
<h1 class="post-title text-center">
17-
<a href="{{ post.url }}">{{ post.title }}</a>
18-
<small class="post-date">{{ post.date | date_to_string }}</small>
19-
</h1>
20-
</article>
21-
{% endfor %}
20+
{% for post in site.posts %}
21+
<article class="post">
22+
<h1 class="post-title text-center">
23+
<a href="{{ post.url }}">{{ post.title }}</a>
24+
<small class="post-date">{{ post.date | date_to_string }}</small>
25+
</h1>
26+
</article>
27+
{% endfor %}
2228
</div> <!-- post-list -->

search.html

+2-75
Original file line numberDiff line numberDiff line change
@@ -3,79 +3,6 @@
33
title: Search issues
44
---
55

6-
<style type="text/css">
7-
/*
8-
fix google custom search conflicts with bootstrap
9-
solutions:
10-
http://css-tricks.com/forums/topic/troubles-with-box-sizing-and-google-custom-search/
11-
http://stackoverflow.com/questions/21932819/google-cse-with-twitter-bootstrap-not-displaying-the-search-box-correctly
12-
*/
13-
.cse:before, .cse:after {
14-
-webkit-box-sizing: inherit;
15-
-moz-box-sizing: inherit;
16-
box-sizing: inherit;
17-
}
6+
<h1 class="text-center">{{ page.title }}</h1>
187

19-
input.gsc-input,
20-
.gsc-input-box,
21-
.gsc-input-box-hover,
22-
.gsc-input-box-focus,
23-
.gsc-search-button {
24-
box-sizing: content-box;
25-
line-height: normal;
26-
}
27-
28-
/*
29-
other hacks for google custom search (gcs)
30-
*/
31-
.gcsc-branding,
32-
.gsc-control-wrapper-cse,
33-
.gsc-control-cse.gsc-control-cse-en {
34-
background-color: #fff;
35-
border-radius: 0.5em;
36-
border-color: #d7d7d7;
37-
}
38-
39-
a.gsst_a,
40-
a.gcsc-branding-clickable {
41-
text-decoration: none;
42-
border-width: 0px;
43-
}
44-
45-
#gs_cb50{
46-
color: #f05138;
47-
}
48-
49-
.gsc-webResult.gsc-result,
50-
.gsc-webResult.gsc-result:hover {
51-
background-color: #fff;
52-
border-color: #fff;
53-
}
54-
55-
.searchbox {
56-
margin: 1rem 0rem 1rem 0rem;
57-
}
58-
</style>
59-
60-
<div class="searchbox">
61-
<h1 class="text-center">{{ page.title }}</h1><br />
62-
<script>
63-
(function() {
64-
var cx = '011538828544940938420:wtjft8gesai';
65-
var gcse = document.createElement('script');
66-
gcse.type = 'text/javascript';
67-
gcse.async = true;
68-
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
69-
'//cse.google.com/cse.js?cx=' + cx;
70-
var s = document.getElementsByTagName('script')[0];
71-
s.parentNode.insertBefore(gcse, s);
72-
})();
73-
</script>
74-
75-
<div class="row">
76-
<div class="col-sm-8 col-sm-offset-2">
77-
<gcse:search></gcse:search>
78-
</div>
79-
</div>
80-
81-
</div>
8+
{% include search_box.html %}

0 commit comments

Comments
 (0)