bard (0.3.14)
Installation
[registry]
default = "gitea"
[registries.gitea]
index = "sparse+ " # Sparse index
# index = " " # Git
[net]
git-fetch-with-cli = truecargo add bard@0.3.14About this package
Bard
Bard is the frontend rendering library for the Tavernworks blog system.
It provides Dioxus components for rendering blog content that has been compiled
into a SQLite database by Loreweaver and parsed by the Tavern engine.
Bard supports both server-side and client-side rendering and is designed to be
integrated into Dioxus applications.
Features
- Dioxus components for routing and rendering blog pages
- Works with content stored in a SQLite database
- Compatible with
dioxus-webanddioxus-desktop - Optional server integration via Axum for local hosting
Usage
To use Bard in a Dioxus application, you must:
- Initialize the database using
bard::init_database. - Add the
Router::<bard::Page>component to your app. - Optionally, define routes that include Bard under your own layout.
Example
#[component]
fn App() -> Element {
rsx! {
Router::<Page> {}
}
}
#[derive(Routable, Clone, PartialEq)]
pub enum Page {
#[layout(Navbar)]
#[route("/")]
Home {},
#[child("/blog")]
Bard
{
child: bard::Page
},
#[route("/:..route")]
PageNotFound { route: Vec<String> }
}
Server-side Initialization
To serve the blog using Axum and load the database:
tokio::runtime::Runtime::new()
.unwrap()
.block_on(async move {
bard::init_database("path/to/tavern.db").await;
});
Features
Enable the following Cargo features as needed:
server: Enables Axum support for database-backed servingweb: Enables Dioxus web support
Copyright & License
Copyright 2025 CyberMages LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this library except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS
Dependencies
| ID | Version |
|---|---|
| dioxus | =0.7.0-rc.1 |
| tavern | ^0.3.0 |
| tokio | ^1.0 |