docs(readme): Updated readme.

This commit is contained in:
Pixelastic 2015-06-18 16:06:05 +02:00
parent 5477b6b0a6
commit 4ac2d652b6
4 changed files with 28 additions and 24 deletions

View File

@ -1,15 +1,7 @@
# Algolia Jekyll Plugin # Algolia Jekyll Plugin
Jekyll plugin to automatically index your Jekyll posts and pages into an Jekyll plugin to automatically index your Jekyll posts and pages into an
Algolia index. Algolia index by simply running `jekyll algolia push`.
## Usage
```shell
$ jekyll algolia push
```
This will push the content of your jekyll website to your Algolia index.
## Installation ## Installation
@ -57,19 +49,29 @@ or the `./_algolia_api_key` file.
Note that if you decide to use the `./_algolia_api_key` approach, we strongly Note that if you decide to use the `./_algolia_api_key` approach, we strongly
encourage you to not track this file in your versionning system. encourage you to not track this file in your versionning system.
## Usage
```shell
$ jekyll algolia push
```
This will push the content of your jekyll website to your Algolia index.
You can specify any option you would normally pass to `jekyll build`, like
`--config`, `--source`, `--destination`, etc.
## Searching
This plugin will only index your data in your Algolia index. Adding search
capabilities is quite easy. You can follow [our tutorials][1] or use our forked
version of the [Hyde theme][2].
## GitHub Pages ## GitHub Pages
Unfortunatly, GitHub does not allow custom plugins to be run on GitHub Pages. Unfortunatly, GitHub does not allow custom plugins to be run on GitHub Pages.
This means that you will have to manually run `jekyll algolia push` before This mean that you will have to manually run `jekyll algolia push` before
pushing your content to GitHub. pushing your content to GitHub.
## Search
Now that your index is populated with your data, you can start searching in it.
You can query it yourself using our [Javascript client][1], or you can use
our updated [Hyde theme][2].
[1]: https://www.algolia.com/doc/javascript [1]: https://www.algolia.com/doc/javascript
[2]: https://github.com/algolia/algoliasearch-jekyll-hyde [2]: https://github.com/algolia/algoliasearch-jekyll-hyde

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = 'algoliasearch-jekyll' s.name = 'algoliasearch-jekyll'
s.version = '0.1.0' s.version = '0.1.1'
s.date = '2015-06-18' s.date = '2015-06-18'
s.summary = 'AlgoliaSearch for Jekyll' s.summary = 'AlgoliaSearch for Jekyll'
s.description = 'Index all your pages and posts to an Algolia index with `jekyll algolia index`' s.description = 'Index all your pages and posts to an Algolia index with `jekyll algolia index`'

View File

@ -14,7 +14,7 @@ class AlgoliaSearchJekyll < Jekyll::Command
command.description 'Keep your content in sync with your Algolia index' command.description 'Keep your content in sync with your Algolia index'
command.command(:push) do |subcommand| command.command(:push) do |subcommand|
subcommand.syntax 'push [INDEX_NAME] [options]' subcommand.syntax 'push [options]'
subcommand.description 'Push your content to your index' subcommand.description 'Push your content to your index'
add_build_options(subcommand) add_build_options(subcommand)
@ -31,13 +31,13 @@ class AlgoliaSearchJekyll < Jekyll::Command
def add_build_options(command) def add_build_options(command)
command.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', command.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]',
Array, 'Custom configuration file' Array, 'Custom configuration file'
command.option 'future', '--future', 'Publishes posts with a future date' command.option 'future', '--future', 'Index posts with a future date'
command.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, command.option 'limit_posts', '--limit_posts MAX_POSTS', Integer,
'Limits the number of posts to parse and publish' 'Limits the number of posts to parse and index'
command.option 'show_drafts', '-D', '--drafts', command.option 'show_drafts', '-D', '--drafts',
'Render posts in the _drafts folder' 'Index posts in the _drafts folder'
command.option 'unpublished', '--unpublished', command.option 'unpublished', '--unpublished',
'Render posts that were marked as unpublished' 'Index posts that were marked as unpublished'
end end
def api_key def api_key

View File

@ -43,7 +43,8 @@ class AlgoliaSearchJekyllPush < Jekyll::Command
Jekyll.logger.error 'Algolia Error: No API key defined' Jekyll.logger.error 'Algolia Error: No API key defined'
Jekyll.logger.warn ' You have two ways to configure your API key:' Jekyll.logger.warn ' You have two ways to configure your API key:'
Jekyll.logger.warn ' - The ALGOLIA_API_KEY environment variable' Jekyll.logger.warn ' - The ALGOLIA_API_KEY environment variable'
Jekyll.logger.warn ' - A file named ./_algolia_api_key' Jekyll.logger.warn ' - A file named ./_algolia_api_key in your '\
'source folder'
exit 1 exit 1
end end
@ -114,7 +115,8 @@ class AlgoliaSearchJekyllPush < Jekyll::Command
end end
end end
Jekyll.logger.info "Indexing of #{items.size} items done." Jekyll.logger.info "Indexing of #{items.size} items " \
"in #{index_name} done."
end end
def get_items_from_file(file) def get_items_from_file(file)