[#1] Blog metadata can be stored using serde.
Created the initial blog data, posts and authors, and allows it to be stored using serde.
This commit is contained in:
40
src/tale.rs
Normal file
40
src/tale.rs
Normal file
@ -0,0 +1,40 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
||||
|
||||
/// A type alias representing the path to a Markdown file.
|
||||
/// This type is used to point to the location of the content of a `Tale`.
|
||||
pub type Markdown = std::path::PathBuf;
|
||||
|
||||
|
||||
/// Represents a post or story in the application.
|
||||
///
|
||||
/// A `Tale` contains metadata about the post such as its title, author,
|
||||
/// and tags, along with a path to its Markdown content.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Tale
|
||||
{
|
||||
/// The title of the tale.
|
||||
pub title: String,
|
||||
|
||||
/// A URL-friendly version of the title, used for routing and linking.
|
||||
pub slug: String,
|
||||
|
||||
/// The name of the author who wrote the tale.
|
||||
pub author: String,
|
||||
|
||||
/// A short summary or description of the tale.
|
||||
pub summary: String,
|
||||
|
||||
/// A list of tags associated with the tale for categorization and searching.
|
||||
pub tags: Vec<String>,
|
||||
|
||||
/// The file path to the Markdown content of the tale.
|
||||
pub content: Markdown
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl Tale
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user