Skip to main content

BlogRegistry

Struct BlogRegistry 

Source
pub struct BlogRegistry {
    pub posts_per_page: usize,
    pub date_format: String,
    pub theme: Option<ThemeConfig>,
    /* private fields */
}
Expand description

Central blog registry holding all parsed content.

Created via BlogConfig builder and typically stored in a LazyLock<BlogRegistry> static.

Fields§

§posts_per_page: usize

Posts per page for pagination.

§date_format: String

Date display format string.

§theme: Option<ThemeConfig>

Optional theme configuration.

Implementations§

Source§

impl BlogRegistry

Source

pub fn get_post(&self, slug: &str) -> Option<&BlogPost>

Source

pub fn all_posts(&self) -> &[BlogPost]

Source

pub fn featured_posts(&self) -> Vec<&BlogPost>

Get all featured/pinned posts, sorted by date (newest first).

Check if there are any featured posts.

Source

pub fn posts_by_tag(&self, tag: &str) -> Vec<&BlogPost>

Get a page of non-featured posts for the main blog index.

Total number of pages for the main blog index, excluding featured posts.

Source

pub fn related_posts(&self, slug: &str, max: usize) -> Vec<&BlogPost>

Find posts related to the given slug by tag overlap.

Returns up to max posts sorted by number of overlapping tags (descending), then by date (newest first). Excludes the current post.

Source

pub fn posts_page(&self, page: usize) -> &[BlogPost]

Source

pub fn posts_page_by_tag(&self, tag: &str, page: usize) -> Vec<&BlogPost>

Source

pub fn total_pages(&self) -> usize

Source

pub fn total_pages_for_tag(&self, tag: &str) -> usize

Source

pub fn prev_post(&self, slug: &str) -> Option<&BlogPost>

Get the previous post (older) relative to the given slug.

Source

pub fn next_post(&self, slug: &str) -> Option<&BlogPost>

Get the next post (newer) relative to the given slug.

Source

pub fn all_tags(&self) -> &[String]

Source

pub fn tag_count(&self, tag: &str) -> usize

Source

pub fn get_author(&self, id: &str) -> Option<&Author>

Source

pub fn search_posts(&self, query: &str) -> Vec<&BlogSearchEntry>

Source

pub fn generate_rss( &self, site_title: &str, site_url: &str, blog_path: &str, ) -> String

Source

pub fn generate_llms_txt( &self, site_title: &str, site_description: &str, base_url: &str, blog_path: &str, ) -> String

Source

pub fn generate_sitemap(&self, site_url: &str, blog_path: &str) -> String

Generate a sitemap.xml for all blog posts.

Source

pub fn format_date(&self, date: &str) -> String

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more