Files
tavernworks/bard
Myrddin Dundragon 87bb1459b8
All checks were successful
Build Tavernworks / Explore-Gitea-Actions (push) Successful in 3m49s
Bumped the bard version for publishing.
2025-10-16 13:58:36 -04:00
..
2025-10-16 13:56:58 -04:00
2025-09-25 11:38:05 -04:00

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-web and dioxus-desktop
  • Optional server integration via Axum for local hosting

Usage

To use Bard in a Dioxus application, you must:

  1. Initialize the database using bard::init_database.
  2. Add the Router::<bard::Page> component to your app.
  3. 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 serving
  • web: Enables Dioxus web support

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