{"id":18712129,"url":"https://github.com/keen/slate_algolia","last_synced_at":"2025-07-30T13:03:18.776Z","repository":{"id":146827132,"uuid":"70920922","full_name":"keen/slate_algolia","owner":"keen","description":"Easily index your Slate-powered docs in Algolia","archived":false,"fork":false,"pushed_at":"2018-05-10T23:52:58.000Z","size":32,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-06T19:36:05.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-10-14T15:05:03.000Z","updated_at":"2019-05-27T16:08:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"b11e78b0-243b-467f-b13d-da4f454d626d","html_url":"https://github.com/keen/slate_algolia","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/keen/slate_algolia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keen%2Fslate_algolia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keen%2Fslate_algolia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keen%2Fslate_algolia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keen%2Fslate_algolia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keen","download_url":"https://codeload.github.com/keen/slate_algolia/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keen%2Fslate_algolia/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267873872,"owners_count":24158721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T12:40:51.883Z","updated_at":"2025-07-30T13:03:18.696Z","avatar_url":"https://github.com/keen.png","language":"Ruby","funding_links":[],"categories":["Ruby","Community Integrations"],"sub_categories":[],"readme":"# Slate_Algolia\n\n`slate_algolia` is a Middleman extension that allows you to easily and automatically index your [Slate docs](https://github.com/lord/slate) in [Algolia](https://www.algolia.com/)\n\n## Installation\n\nIf you're not using Bundler, simply install the gem:\n\n```ssh\ngem install slate_algolia\n```\n\nIf you are using Bundler, add `slate_algolia` to your Gemfile\n```ruby\ngem slate_algolia\n```\n\nand then reinstall your gems\n\n```ssh\nbundle install\n```\n\n## Configuration\n\nThe most simple way to activate the extension is to add this code to your `config.rb`:\n\n```ruby\nactivate :slate_algolia do |options|\n  options.application_id = 'ABCD'\n  options.api_key = '1234'\nend\n```\n\nYou also need to add a line to the YAML Frontmatter of your Slate docs index. This is necessary because many companies embed Slate inside of a larger docs site.\n\n```YAML\nalgolia_search: true\n```\n\nThere are some additional configurations you can enable:\n\n```ruby\nactivate :slate_algolia do |options|\n  options.application_id = 'ABCD'  # Algolia Application ID\n  options.api_key        = '1234'  # Algolia API Key\n  options.dry_run        = true    # Don't send data to Algolia, but output some log information instead\n  options.parsers        = {}      # Custom tag parsers (discussed later in the docs)\n  options.before_index   = nil     # Proc for changing the data model before it is sent to Algolia\nend\n```\n\n## Changing the Data Model\n\nWhile the data model built in is pretty well thought-out, everyone's search needs will be different. Some projects of course will need to mold the data model to meet their needs. To do that, you can hook in to the indexing process and modify the records _just before_ they are shipped off to Algolia.\n\nSet it up in your config file:\n\n```ruby\nactivate :slate_algolia do |options|\n  options.before_index = proc { |record|\n    # Change the key name for the body to 'content'\n    record[:content] = record[:body]\n    record.delete(:body)\n\n    record\n  }\nend\n```\n\nIf you would like to turn a single record into multiple records, simply return an array of records\n\n```ruby\nactivate :slate_algolia do |options|\n  options.before_index = proc { |record|\n    # Create a record for each language in the code examples\n    record.permanent_code.map.with_index { |language, code|\n      new_record = record.merge({\n        code: code,\n        language: language\n      })\n      new_record.delete(permanent_code)\n\n      new_record\n    }\n  }\nend\n```\n\n## Filtering Deletes\n\n`slate_algolia` has automatic cleanup built in - meaning that after indexing new content, it will look through Algolia for any content that exists there but **does not** exist in the current content. It will remove those items, assuming they have been removed from the active content. However, you may not want to delete all of your unmatched records - perhaps they serve as a good synonym, or perhaps you index more than just slate docs in that Algolia index. There is a hook option you can use the filter out records from being deleted.\n\n```ruby\nactivate :slate_algolia do |options|\n  options.filter_deletes = proc { |record|\n    if record['category'] == 'API Docs'\n      true # Truthy values will be deleted\n    else\n      false # Non-Truthy values will be ignored\n    end\n  }\nend\n```\n\n\n## Custom Tag Parser\n\nTODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeen%2Fslate_algolia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeen%2Fslate_algolia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeen%2Fslate_algolia/lists"}