diff --git a/Rules b/Rules index fffeac2..50ba791 100644 --- a/Rules +++ b/Rules @@ -1,6 +1,20 @@ #!/usr/bin/env ruby # 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 compile '/*.erb' do layout '/default.*' @@ -21,9 +35,6 @@ end # Compile all posts compile '/posts/**/*.md' do - # Every post is an article, needed for blogging helper - @item.attributes[:kind] = 'article' - filter :kramdown layout '/eventpost.*' @@ -52,3 +63,20 @@ route '/**/*.{erb,html,md}' do end 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 diff --git a/content/assets/stylesheets/main.scss b/content/assets/stylesheets/main.scss index 43eae56..2e1bb5e 100644 --- a/content/assets/stylesheets/main.scss +++ b/content/assets/stylesheets/main.scss @@ -5,7 +5,7 @@ $event-border-color: #DDD; $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, .pure-g [class *= "pure-u"] { diff --git a/content/index.erb b/content/index.erb index 8f6d386..79ba798 100644 --- a/content/index.erb +++ b/content/index.erb @@ -20,6 +20,15 @@ <%= render '/partials/_navbar.*' %>
+
+ +
+
+
<%= render '/partials/_tile.*', article: sorted_articles[0] %>
diff --git a/layouts/default.erb b/layouts/default.erb index 8d8edd1..34146ab 100644 --- a/layouts/default.erb +++ b/layouts/default.erb @@ -24,6 +24,11 @@ + + + + + <%= content_for(@item, :head) %>