Skip to main content

PageLayout

Enum PageLayout 

Source
pub enum PageLayout {
    Site,
    Bare,
    Verbatim,
}
Expand description

Which shell a page is wrapped in, from its frontmatter layout:.

Variants§

§

Site

The site shell: nav, breadcrumbs, footer, site stylesheet, built-in interactivity script — or the caller’s template in place of all of it. What a page with no layout: gets.

§

Bare

A complete document with none of the site’s frame: no nav, no breadcrumbs, no footer, no site stylesheet and no built-in script — only the page’s own styles:/scripts: around its rendered body.

For a page that is a design of its own (a landing page, a poster, a visualization) rather than an entry in a site’s furniture. It still appears in the nav, the sitemap and the feeds like any other page: bare is about what the page looks like, not about whether the site knows it.

A supplied shell template does not apply to it — bare is a statement that this page carries its own frame, and wrapping it in someone else’s would be the thing it asked not to happen.

§

Verbatim

The body is the file. Everything after the metadata block is written out byte for byte: no wrapper, no head, no head links, no chrome — and, unlike every other layout, no parse either.

A bare page is still rendered: its body goes through templating, twig, and link rewriting, and comes back as twig’s serialization of it. That is right for prose and wrong for a hand-authored page, where a reserialized document is a different document — attribute order moves, void tags are respelled, an inline <script> survives or does not depending on how the parser felt about it. A designed landing page is a file someone wrote, not a document someone described, and the only faithful thing to do with it is copy it.

So verbatim is for a self-contained HTML file that carries frontmatter only so the vault can see it: the metadata makes it a document the site knows — it appears in the nav, the sitemap and the feeds like any other page — while the bytes below the metadata are published unread.

The cost is that nothing is done for it. Its links are not rewritten, so a .md href in it stays a .md href and a vault-root-absolute path stays absolute; its styles:/scripts: are not emitted, since there is no head to emit them into. A verbatim page is responsible for itself, which is the point of asking for one.

Implementations§

Source§

impl PageLayout

Source

pub fn parse(value: Option<&str>) -> Self

Read a frontmatter layout: value. Anything unrecognized — including the absent case — is PageLayout::Site, because a site whose theme spells a layout this version does not know should still publish.

Source

pub fn is_verbatim(self) -> bool

Whether the body is published unread — no templating, no parse, no link rewriting. True only for PageLayout::Verbatim.

Trait Implementations§

Source§

impl Clone for PageLayout

Source§

fn clone(&self) -> PageLayout

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PageLayout

Source§

impl Debug for PageLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PageLayout

Source§

fn default() -> PageLayout

Returns the “default value” for a type. Read more
Source§

impl Eq for PageLayout

Source§

impl PartialEq for PageLayout

Source§

fn eq(&self, other: &PageLayout) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PageLayout

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.