pub struct ContentPath {
pub path: PathBuf,
pub lang: String,
pub is_default_lang: bool,
pub canonical_id: String,
pub slug: String,
pub content_type: ContentType,
}Expand description
Parsed content path with language and slug extraction.
Fields§
§path: PathBufOriginal file path.
lang: StringLanguage code for this content (always set, defaults to site default).
is_default_lang: boolWhether this is the default language version.
canonical_id: StringCanonical identifier for translation linking (language-neutral slug). Used to group translations: “posts/hello” in both “hello.md” and “hello.zh.md”
slug: StringURL slug derived from the path (may include language prefix for non-default).
content_type: ContentTypeContent type based on extension.
Implementations§
Source§impl ContentPath
impl ContentPath
Sourcepub fn from_path(path: &Path, default_lang: &str) -> Option<Self>
pub fn from_path(path: &Path, default_lang: &str) -> Option<Self>
Parse a content path to extract language and slug.
Supports patterns like:
posts/hello.md→ lang: “en” (default), canonical_id: “posts/hello”, slug: “posts/hello”posts/hello.zh.md→ lang: “zh”, canonical_id: “posts/hello”, slug: “zh/posts/hello”posts/hello/index.md→ lang: “en” (default), canonical_id: “posts/hello”, slug: “posts/hello”posts/hello/index.zh.md→ lang: “zh”, canonical_id: “posts/hello”, slug: “zh/posts/hello”
Trait Implementations§
Source§impl Clone for ContentPath
impl Clone for ContentPath
Source§fn clone(&self) -> ContentPath
fn clone(&self) -> ContentPath
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContentPath
impl Debug for ContentPath
Source§impl PartialEq for ContentPath
impl PartialEq for ContentPath
impl Eq for ContentPath
impl StructuralPartialEq for ContentPath
Auto Trait Implementations§
impl Freeze for ContentPath
impl RefUnwindSafe for ContentPath
impl Send for ContentPath
impl Sync for ContentPath
impl Unpin for ContentPath
impl UnwindSafe for ContentPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.