Cleaned up some Author related displays.

It was determined to use the Author's desired name and no handle. The
handle will only be used for unique linking.

Also, the CyberMages LLC was dropped from the Author metadata until a
company can be specified per Author. Not all users will be associated
with CyberMages.
This commit is contained in:
2025-10-07 11:31:07 -04:00
parent cba2e95290
commit ce80af94ee
4 changed files with 215 additions and 133 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "bard"
version = "0.3.4"
version = "0.3.5"
edition = "2024"
description = "Dioxus components that will display a Tavern blogging system Blog."
repository = "/CyberMages/tavern"

View File

@ -15,6 +15,13 @@ pub fn BlogItem(title: String, slug: String, author: String, summary: String,
tags: Vec<String>)
-> Element
{
let author_future = use_server_future(move ||
{
let handle: String = author.clone();
async move { get_author(handle).await }
})?;
rsx!
{
article
@ -42,7 +49,24 @@ pub fn BlogItem(title: String, slug: String, author: String, summary: String,
}
}
p { b { "Author: {author}" } }
if let Some(Ok(Some(adventurer))) = (author_future.value())()
{
p
{
b
{
"Author: "
a
{
href: "{adventurer.legend.profile}", "{adventurer.name}"
}
}
}
}
else
{
p { "Loading author..." }
}
p { "{summary}" }
}

View File

@ -1,6 +1,9 @@
use dioxus::prelude::*;
use tavern::{Adventurer, Tale};
use dioxus::prelude::*;
use crate::page::Page;
use crate::settings::BardSettings;
use crate::server::*;
use super::tags::*;
@ -24,12 +27,18 @@ pub fn PostHeaderAuthor(adventurer: Adventurer) -> Element
{
rsx!
{
document::Meta
{
name: "author",
content: "{adventurer.name}"
}
p
{
b
{
"Author: ",
a { href: "{adventurer.legend.profile}", "{adventurer.name} @{adventurer.handle}" }
a { href: "{adventurer.legend.profile}", "{adventurer.name}" }
}
}
}
@ -38,6 +47,14 @@ pub fn PostHeaderAuthor(adventurer: Adventurer) -> Element
#[component]
pub fn PostHeader(tale: Tale) -> Element
{
// Get the pages URL.
let url: Page = use_route();
// Get the blog's image to use as a placeholder if there isn't one for the
// blog post.
// Retrieve the provided settings from context.
let _settings = use_context::<BardSettings>();
let author_future = use_server_future(move ||
{
let handle: String = tale.lore.author.clone();
@ -47,6 +64,17 @@ pub fn PostHeader(tale: Tale) -> Element
rsx!
{
// Adding for SEO and OpenGraph post sharing.
document::Meta { name: "title", content: "{tale.lore.title}" }
document::Meta { name: "description", content: "{tale.lore.summary}" }
// Open Graph (used by LinkedIn, Bluesky, Discord, etc.)
document::Meta { property: "og:type", content: "article" }
document::Meta { property: "og:title", content: "{tale.lore.title}" }
document::Meta { property: "og:description", content: "{tale.lore.summary}" }
document::Meta { property: "og:url", content: "{url}" }
document::Meta { property: "og:image", content: "" }
h1 { {tale.lore.title} }
TagList