Giter Club home page Giter Club logo

octopress-lunr-theme's Introduction

octopress-lunr-theme

All the needed for lunrjs search on octopress. in easy steps.

This post is inspired from jekyll-lunr-js-search and octopress-lunr-js-search. I couldn't find easy plugins to install/use so I decided to create a minimalist theme that integrated it directly. This theme is based on a structure allowing Octopress updates.

Example

Plugin installation.

This theme only modify the source/_includes/custom/head.html file. You can execute the following commands to gain a lot of time.

This part explains how to quickly install the plugin as well as the structures that it needs. Let's start by working on a new branch just in case your theme in place does not support this quick installation.

$ git checkout -b octopress-lunr-theme
$ sed -i "/^end/c\  gem 'json'\n  gem 'nokogiri'\nend" Gemfile
$ bundle install
$ git clone https://github.com/alain-andre/octopress-lunr-theme.git .themes/octopress-lunr-theme
$ # If you do not have a theme installed (first install), you must command : bundle exec rake install
$ bundle exec rake install["octopress-lunr-theme"] # In any case
$ bundle exec rake new_page['search']
mkdir -p source/search
Creating new page: source/search/index.markdown
$ echo "{% include custom/lunr_search/entries.html %}" >> source/search/index.markdown
$ cp .themes/octopress-lunr-theme/plugins/octopress_lunr_theme.rb plugins/octopress_lunr_theme.rb
$ sed -i "/^simple_search:/c\simple_search: #" _config.yml
$ sed -i "s/^default_asides: \[/default_asides: \[custom\/asides\/lunr_search.html, /" _config.yml
$ bundle exec rake generate
$ git add -A
$ git commit -m "lunr-js-search Installation"

Voilà, you just need now to do a bundle exec rake preview to see everythings working. Now it's time to go back to your master branch and check if there is changes at your source/_includes/custom/head.html file.

$ git checkout master
$ git merge octopress-lunr-theme

Pour les français

J'ai fais un post sur mon blog qui est plus détaillé.

octopress-lunr-theme's People

octopress-lunr-theme's Issues

undefined methods

When running

bundle exec rake generate
it produces following outpu:

kc@ubuntu ~/code/dshopTutorials (octopress-lunr-theme)
$ bundle exec rake generate
## Generating Site with Jekyll
identical source/stylesheets/screen.css 
Configuration from /home/kc/code/dshopTutorials/_config.yml
/home/kc/code/dshopTutorials/plugins/octopress_lunr_theme.rb:17:in `initialize': undefined method `Hash' for #<Jekyll::Indexer:0x941ffb0> (NoMethodError)
        from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:92:in `new'
        from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:92:in `block in setup'
        from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:89:in `map'
        from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:89:in `setup'
        from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:31:in `initialize'
        from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/bin/jekyll:238:in `new'
        from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/bin/jekyll:238:in `<top (required)>'
        from /usr/local/bin/jekyll:23:in `load'
        from /usr/local/bin/jekyll:23:in `<main>'

_config.yml

I guess it is not enough to comment out the simple search
rather also
lunr_search: true
should be set

#simple_search: https://www.google.com/search
lunr_search: true

sass folder missing

Hi,

when running
$ bundle exec rake install["octopress-lunr-theme"] # In any case
rake complains about the missing sass folder.

Copying from the classic theme resolves this, but I could not get it running due to other issues...

Anyway: Thanks for the shortcut (try so far ;) )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.