start work on tipue search
This commit is contained in:
parent
c938586cf1
commit
bce47ca93b
4 changed files with 46 additions and 4 deletions
34
Rules
34
Rules
|
@ -1,6 +1,20 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
preprocess do
|
||||||
|
# Tag all posts with 'article'
|
||||||
|
@items.find_all('/posts/**/*.md').each do |i|
|
||||||
|
i.attributes[:kind] = 'article'
|
||||||
|
end
|
||||||
|
|
||||||
|
@items.create('', {}, '/tipuesearch_content.js', binary: false)
|
||||||
|
end
|
||||||
|
|
||||||
|
# This makes sure this tipuesearch_content doesn't get deleted
|
||||||
|
passthrough '/tipuesearch_content.js'
|
||||||
|
|
||||||
# ERB
|
# ERB
|
||||||
compile '/*.erb' do
|
compile '/*.erb' do
|
||||||
layout '/default.*'
|
layout '/default.*'
|
||||||
|
@ -21,9 +35,6 @@ end
|
||||||
|
|
||||||
# Compile all posts
|
# Compile all posts
|
||||||
compile '/posts/**/*.md' do
|
compile '/posts/**/*.md' do
|
||||||
# Every post is an article, needed for blogging helper
|
|
||||||
@item.attributes[:kind] = 'article'
|
|
||||||
|
|
||||||
filter :kramdown
|
filter :kramdown
|
||||||
|
|
||||||
layout '/eventpost.*'
|
layout '/eventpost.*'
|
||||||
|
@ -52,3 +63,20 @@ route '/**/*.{erb,html,md}' do
|
||||||
end
|
end
|
||||||
|
|
||||||
layout '/**/*', :erb
|
layout '/**/*', :erb
|
||||||
|
|
||||||
|
postprocess do
|
||||||
|
tmp = articles.map do |e|
|
||||||
|
{
|
||||||
|
title: e[:title],
|
||||||
|
url: url_for(e),
|
||||||
|
text: '',
|
||||||
|
tags: ''
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
tmp = { pages: tmp }
|
||||||
|
|
||||||
|
File.open('output/tipuesearch_content.js', 'w') do |f|
|
||||||
|
f.write("var tipuesearch = #{tmp.to_json};")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ $event-border-color: #DDD;
|
||||||
|
|
||||||
$cammie-controls-color: rgba(0, 0, 0, 0.60);
|
$cammie-controls-color: rgba(0, 0, 0, 0.60);
|
||||||
|
|
||||||
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);
|
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
|
||||||
|
|
||||||
html, button, input, select, textarea,
|
html, button, input, select, textarea,
|
||||||
.pure-g [class *= "pure-u"] {
|
.pure-g [class *= "pure-u"] {
|
||||||
|
|
|
@ -20,6 +20,15 @@
|
||||||
<%= render '/partials/_navbar.*' %>
|
<%= render '/partials/_navbar.*' %>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
<form action="?">
|
||||||
|
<input type="text" name="q" id="tipue_search_input" autocomplete="off" required>
|
||||||
|
</form>
|
||||||
|
<div id="tipue_search_content"></div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#tipue_search_input').tipuesearch();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<div id="all-events">
|
<div id="all-events">
|
||||||
<%= render '/partials/_tile.*', article: sorted_articles[0] %>
|
<%= render '/partials/_tile.*', article: sorted_articles[0] %>
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
|
|
||||||
<meta property="fb:app_id" content="597670540410704">
|
<meta property="fb:app_id" content="597670540410704">
|
||||||
|
|
||||||
|
<script src="/tipuesearch_content.js"></script>
|
||||||
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch.css" rel="stylesheet">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch_set.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch.min.js"></script>
|
||||||
|
|
||||||
<%= content_for(@item, :head) %>
|
<%= content_for(@item, :head) %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue