pub struct Config {
pub site: SiteConfig,
pub build: BuildConfig,
pub search: SearchConfig,
pub rss: RssConfig,
pub robots: RobotsConfig,
pub taxonomies: TaxonomyConfig,
pub languages: HashMap<String, LanguageConfig>,
}Expand description
Main configuration structure for Typstify.
Fields§
§site: SiteConfigSite-wide settings.
build: BuildConfigBuild settings.
search: SearchConfigSearch settings.
rss: RssConfigRSS feed settings.
robots: RobotsConfigRobots.txt settings.
taxonomies: TaxonomyConfigTaxonomy settings.
languages: HashMap<String, LanguageConfig>Language-specific configurations.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_with_env(path: &Path) -> Result<Self>
pub fn load_with_env(path: &Path) -> Result<Self>
Load configuration using the config crate for more flexibility.
Sourcepub fn has_language(&self, lang: &str) -> bool
pub fn has_language(&self, lang: &str) -> bool
Check if a language code is configured (either as default or in languages map).
Sourcepub fn all_languages(&self) -> Vec<&str>
pub fn all_languages(&self) -> Vec<&str>
Get all configured language codes.
Sourcepub fn title_for_language(&self, lang: &str) -> &str
pub fn title_for_language(&self, lang: &str) -> &str
Get language-specific title, falling back to site title.
Sourcepub fn description_for_language(&self, lang: &str) -> Option<&str>
pub fn description_for_language(&self, lang: &str) -> Option<&str>
Get language-specific description, falling back to site description.
Sourcepub fn language_name<'a>(&'a self, lang: &'a str) -> &'a str
pub fn language_name<'a>(&'a self, lang: &'a str) -> &'a str
Get display name for a language code.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more