Crate hugo_to_json

Source
Expand description

A crate for parsing YAML or TOML files from a Hugo contents directory to produce a JSON representation of the key front matter and contents of Hugo documents. It’s main intent is to produce JSON to be used by Lunr (and Lunr-like packages) to support search on a static Hugo site.

Modules§

hugo_to_json_error
Contains possible errors.
operation_result
Represents the result of trying to parse a file.
page_index
Contains the PageIndex data structure.
settings
Contains configuration options.

Functions§

convert_to_json_and_write
Converts a Hugo contents directory to JSON and writes it to a given location. If the output location is provided and it doesn’t exist, it will be created. If no output location it will write to stdout.
create_page_index
Given a contents directory it traverses all matching .md files with TOML and YAML frontmatter.