Static web site generator
bar <path to bar project>
Configuration file config.yaml
should be in root folder of a project.
# destination
dist_path: './dist'
# path to folder that contain yamd files
content_path: './content/'
#path from where get static files
static_source_path: './static'
# Non required filed with white list of allowed file extensions.
# Defaults to ["css", "js", "png", "jpg", "jpeg", "gif", "svg", "webmanifest", "ico", "txt"]
static_files_extensions:
- txt
- jpg
- png
# path to template
template: '../hamon/'
domain: 'https://blog.com'
title: 'this is the blog'
description: 'blog'
yamd_processors:
# if set to true BAR will convert Cloudinary [Embed](https://docs.rs/yamd/latest/yamd/nodes/struct.Embed.html)
# to [Images](https://docs.rs/yamd/latest/yamd/nodes/struct.Images.html)
convert_cloudinary_embed: true
# hash map to configure template free form, depends on a template
# will be provided to template
template_config:
should_unpack_cloudinary: false
BAR will gather static files from:
- Path specified in
config.static_source_path
static
directory in template- Defaults from BAR (check out robots.txt section)
If file exists source it will be not overwritten with file from template or BAR. If however you want to overwrite file from template with your own version. For example if you want custom CSS, you can add it to the static folder of source.
Only files with allowed extensions will be copied. Default list of extensions:
- css
- js
- png
- jpg
- jpeg
- gif
- svg
- webmanifest
- ico
- txt
It can be customized with config.static_files_extensions
param.
If source or template does not provide the robots.txt
static file, BAR will generate default one:
User-agent: *
Allow: /
BAR uses Tera templating engine.
Example of bar template: Hamon
If bar template has ./404.html
it will be rendered to the config.dest_path
+ 404.html
Takes 5 arguments
- path
- template
- title
- description
- page_num
Example:
{{ add_page(path = '/',template = 'index.html', title = config.title, description = config.description, page_num = 0) }}
Takes one argument
- path
Returns relative url with cache buster. Cache buster is crc32 of a file content.
example:
{{ get_static_file( path='/favicon.ico' )}}
BAR MSRV is 1.80.0