Skip to content

Commit

Permalink
Initial work on lunrjs search.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashfurrow committed Mar 25, 2017
1 parent 8f08e38 commit 65ea910
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 90 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -8,6 +8,7 @@ gem 'rdiscount'
gem 'pygments.rb' gem 'pygments.rb'
gem 'RedCloth' gem 'RedCloth'
gem 'pry' gem 'pry'
gem 'jekyll-lunr-js-search', git: 'https://github.com/ashfurrow/jekyll-lunr-js-search.git', branch: 'v2'


group :distribution do group :distribution do
gem 'danger' gem 'danger'
Expand Down
21 changes: 20 additions & 1 deletion Gemfile.lock
@@ -1,3 +1,13 @@
GIT
remote: https://github.com/ashfurrow/jekyll-lunr-js-search.git
revision: f39837bf2fc7a1b2ac408b2d1386acefbb65c219
branch: v2
specs:
jekyll-lunr-js-search (3.0.0)
nokogiri (~> 1.6)
therubyracer (~> 0.12)
yajl-ruby

GIT GIT
remote: https://github.com/dbgrandi/danger-prose remote: https://github.com/dbgrandi/danger-prose
revision: 53603ff7d13691c0c7772e13474a6c10958fcfa5 revision: 53603ff7d13691c0c7772e13474a6c10958fcfa5
Expand Down Expand Up @@ -87,16 +97,20 @@ GEM
jekyll-watch (1.2.1) jekyll-watch (1.2.1)
listen (~> 2.7) listen (~> 2.7)
kramdown (1.13.1) kramdown (1.13.1)
libv8 (3.16.14.19)
liquid (2.6.3) liquid (2.6.3)
listen (2.10.1) listen (2.10.1)
celluloid (~> 0.16.0) celluloid (~> 0.16.0)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
mercenary (0.3.5) mercenary (0.3.5)
method_source (0.8.2) method_source (0.8.2)
mini_portile2 (2.1.0)
multi_json (1.11.2) multi_json (1.11.2)
multipart-post (2.0.0) multipart-post (2.0.0)
nap (1.1.0) nap (1.1.0)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
octokit (4.6.2) octokit (4.6.2)
sawyer (~> 0.8.0, >= 0.5.3) sawyer (~> 0.8.0, >= 0.5.3)
octopress-hooks (2.6.1) octopress-hooks (2.6.1)
Expand All @@ -119,6 +133,7 @@ GEM
ffi (>= 0.5.0) ffi (>= 0.5.0)
rdiscount (2.1.7) rdiscount (2.1.7)
redcarpet (3.3.4) redcarpet (3.3.4)
ref (2.0.0)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sass (3.4.16) sass (3.4.16)
sawyer (0.8.1) sawyer (0.8.1)
Expand All @@ -127,6 +142,9 @@ GEM
slop (3.6.0) slop (3.6.0)
terminal-table (1.7.3) terminal-table (1.7.3)
unicode-display_width (~> 1.1.1) unicode-display_width (~> 1.1.1)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
timers (4.0.1) timers (4.0.1)
hitimes hitimes
toml (0.1.2) toml (0.1.2)
Expand All @@ -143,11 +161,12 @@ DEPENDENCIES
danger danger
danger-prose! danger-prose!
jekyll jekyll
jekyll-lunr-js-search!
octopress-hooks octopress-hooks
pry pry
pygments.rb pygments.rb
rake rake
rdiscount rdiscount


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


exclude: [vendor] exclude: [vendor]


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

markdown: rdiscount markdown: rdiscount
highlighter: pygments highlighter: pygments


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


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


<div id="search-container"> <div id="search-container">
<script> <div class="entries">
(function() { </div>
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> </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">
<ul>
{{#entries}}
<li>
<a href="{{url}}">{{title}}</a>{{#date}}<small><time datetime="{{pubdate}}" pubdate>{{displaydate}}</time></small>{{/date}}
</li>
{{/entries}}
</ul>
</script>
{% endraw %}
72 changes: 2 additions & 70 deletions _sass/screen.scss
Expand Up @@ -947,76 +947,8 @@ figure.code {
margin-left: 250px; margin-left: 250px;
text-decoration: none; text-decoration: none;


.gsc-above-wrapper-area { a {
border-bottom: 1px solid $artsy-text; font-weight: bold;
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;
border-bottom: 1px solid $artsy-text;
}
.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;
}
.gs-snippet b:first-of-type {
display: block;
opacity: 0;
} }
} }


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


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

0 comments on commit 65ea910

Please sign in to comment.