Skip to content

Commit

Permalink
Merge pull request #332 from artsy/search
Browse files Browse the repository at this point in the history
lunrjs Search
  • Loading branch information
orta committed Mar 27, 2017
2 parents bee10e9 + a879c40 commit 9f65be6
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 99 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gem 'rdiscount'
gem 'pygments.rb'
gem 'RedCloth'
gem 'pry'
gem 'jekyll-lunr-js-search', git: 'https://github.com/ashfurrow/jekyll-lunr-js-search.git', branch: 'v2'

group :distribution do
gem 'danger'
Expand Down
30 changes: 28 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
GIT
remote: https://github.com/ashfurrow/jekyll-lunr-js-search.git
revision: 5a4b5d5e72abc5fcd05db3f3456ab9aee1cc06dc
branch: v2
specs:
jekyll-lunr-js-search (3.0.0)
nokogiri (~> 1.6)
therubyracer (~> 0.12)
yajl-ruby

GIT
remote: https://github.com/dbgrandi/danger-prose
revision: 53603ff7d13691c0c7772e13474a6c10958fcfa5
specs:
danger-prose (1.0.0)
danger

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -82,17 +99,21 @@ GEM
sass (~> 3.2)
jekyll-watch (1.2.1)
listen (~> 2.7)
kramdown (1.13.2)
kramdown (1.13.1)
libv8 (3.16.14.19)
liquid (2.6.3)
listen (2.10.1)
celluloid (~> 0.16.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
mercenary (0.3.5)
method_source (0.8.2)
mini_portile2 (2.1.0)
multi_json (1.11.2)
multipart-post (2.0.0)
nap (1.1.0)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
octokit (4.6.2)
sawyer (~> 0.8.0, >= 0.5.3)
octopress-hooks (2.6.1)
Expand All @@ -115,6 +136,7 @@ GEM
ffi (>= 0.5.0)
rdiscount (2.1.7)
redcarpet (3.3.4)
ref (2.0.0)
safe_yaml (1.0.4)
sass (3.4.16)
sawyer (0.8.1)
Expand All @@ -123,6 +145,9 @@ GEM
slop (3.6.0)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
timers (4.0.1)
hitimes
toml (0.1.2)
Expand All @@ -139,11 +164,12 @@ DEPENDENCIES
danger
danger-prose
jekyll
jekyll-lunr-js-search!
octopress-hooks
pry
pygments.rb
rake
rdiscount

BUNDLED WITH
1.13.6
1.14.3
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ disqus_show_comment_count: false

exclude: [vendor]

gems: ['jekyll-lunr-js-search']
lunr_search:
js_dir: "javascripts"

markdown: rdiscount
highlighter: pygments

Expand Down
1 change: 1 addition & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<script src="{{ root_url }}/javascripts/gradient-fade.js"></script>
<script src="{{ root_url }}/javascripts/noframework.waypoints.min.js"></script>
<script src="{{ root_url }}/javascripts/sticky.min.js"></script>
<script src="{{ root_url }}/javascripts/search.min.js"></script>

{% if page.opensource == true %}
<script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script>
Expand Down
3 changes: 1 addition & 2 deletions _includes/search.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% if site.google_custom_search %}
<form action="/search" method="get">
<input type="hidden" value="{{ site.google_custom_search }}" name="cx"/>
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
<input class="search" id="search-query" type="text" name="q" results="0" placeholder="Search"/>
</form>
{% endif %}
44 changes: 27 additions & 17 deletions _layouts/search.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
---
layout: default
exclude_from_search: true
---

<div id="search-container">
<script>
(function() {
var cx = '010245880960712892902:tnjd4ryb3ci';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only>
<div class="spinner-wrapper">
<div class="spinner"></div>
</div>
</gcse:searchresults-only>
<div class="entries">
</div>
</div>

<script type="text/javascript">
$(function() {
$('#search-query').focus().lunrSearch({
indexUrl : '/javascripts/index.json', // url for the .json file containing search index data
results : '#search-container', // selector for containing search results element
template : '#search-results-template', // selector for Mustache.js template
});
});
</script>


{% raw %}
<script id="search-results-template" type="text/mustache">
<h2>Search results for &ldquo;{{query}}&rdquo;</h2>
<ul>
{{#entries}}
<li>
<a href="{{url}}">{{title}}</a> - {{#date}}<small><time datetime="{{pubdate}}" pubdate>{{displaydate}}</time></small>{{/date}}
</li>
{{/entries}}
</ul>
</script>
{% endraw %}
76 changes: 9 additions & 67 deletions _sass/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -947,76 +947,18 @@ figure.code {
margin-left: 250px;
text-decoration: none;

.gsc-above-wrapper-area {
border-bottom: 1px solid $artsy-text;
margin-bottom: 40px;
}
.gsc-result-info-container, .gsc-orderby-container {
color: $artsy-text;
padding: 0;
padding-bottom: 20px;
margin-bottom: 20px;
}
.gsc-orderby-container {
display: none;
}
.gsc-result-info, .gsc-orderby-label {
color: $artsy-text;
}
.gsc-webResult {
padding: 0;
padding-bottom: 40px;
margin-bottom: 40px;
border-style: none;
}
.gsc-result-info {
padding: 0;
font-size: 20px;
}
.gs-snippet{
background-color: rgba(0,0,0,0);
font-family: $serif;
border-style: none;
font-size: 20px;
padding: 0;
margin: 0;
b {
color: black;
text-decoration: underline;;
}
}
.gsc-result{
background-color: rgba(0,0,0,0);
text-decoration: none;
h2 {
border-bottom: 1px solid $artsy-text;
margin: 60px 0 20px 0;
clear: both;
}
.gsc-control-cse{
padding: 0;
background-color: rgba(0,0,0,0);
border-style: none;
font-family: $serif;
font-size: 20px;
}
.gs-title{
font-family: $serif;
font-weight: 600;
font-size: 20px;
text-decoration: none;
b {
font-family: $serif;
text-decoration: none;
font-size: 20px;
}
}
.gsc-thumbnail-inside, .gsc-url-top, .gsc-table-result, .gsc-cursor-box{
padding: 0;
}
.gs-visibleUrl {
display: none;

a {
font-weight: bold;
}
.gs-snippet b:first-of-type {
display: block;
opacity: 0;

li {
margin-bottom: 30px;
}
}

Expand Down
11 changes: 0 additions & 11 deletions about.md

This file was deleted.

1 change: 1 addition & 0 deletions blog/archives/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: page
title: Blog Archive
footer: false
exclude_from_search: true
---

<div id="blog-archives">
Expand Down
1 change: 1 addition & 0 deletions feed.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
layout: null
exclude_from_search: true
---
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
Expand Down
1 change: 1 addition & 0 deletions open-source/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
comments: false
sharing: true
footer: true
exclude_from_search: true
---
<div id="page-sidebar">
<ul>
Expand Down

0 comments on commit 9f65be6

Please sign in to comment.