Skip to content

Lektor plugin for serialize sources contents to json for using with static search js libraries

Notifications You must be signed in to change notification settings

rlaverde/lektor-static-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Lektor plugin for serialize sources contents to json for using with static search js libraries

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages