Files
tavernworks/bard
Myrddin Dundragon 3fe3d874ca Added the ability to specify images.
The blog title can now be set to be an image. If not it will default to
the text. If no text it will just be "Blog".

A Post has now been given a default post image that will be used for all
posts for their openGraph sharing. This can later be expanded to allow
a blog post to have a desired image.
2025-10-09 17:00:56 -04:00
..
2025-10-09 17:00:56 -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