Lektor plugin for serialize sources contents to json for using with static search js libraries
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
lektor_static_search.py
setup.py

README.md

lektor-static-search

This is under development

This is a plugin for Lektor that adds support for static search to projects. When enabled it can generate json files in the static-search/ folder automatically when the server (or build process) is run with the -f static-search flag.

This json files can be used with js libraries like Tipue search or Lurn.js.

Enabling the Plugin

To enable the plugin add this to your project file, run this command while sitting in your Lektor project directory:

lektor plugins add lektor-static-search

Configurations

There are some globals configurations:

configs/static-search.ini:

output_directory = static_search

Also you should add an entry for any model that you want to be generated into de json file (it should start by model)

configs/static-search.ini:

[model.blog-post]
title = title
text = summary
tags = tags

The first part is the json key and the sepcond the model key, i.e the previous configuration correspod to a model:

models/blog-post.ini:

[model]
name = Blog Post

[fields.title]
label = Title
type = string

[fields.summary]
label = Summary
type = string

[fields.tags]
label = Tags
type = checkboxes
choices = some_tag, another_tag

and will generate a json file (for each alternative):

static_search/static_search_en.json:

[{"url": "/blog/example",
"text": "This is the blog Summary",
"title": "Blog Example",
"tags": ["example", "some_tag"]},

]

Usage

lektor build -f static-search