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
impl PageLayout
Sourcepub fn parse(value: Option<&str>) -> Self
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.
Sourcepub fn is_verbatim(self) -> bool
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
impl Clone for PageLayout
Source§fn clone(&self) -> PageLayout
fn clone(&self) -> PageLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PageLayout
Source§impl Debug for PageLayout
impl Debug for PageLayout
Source§impl Default for PageLayout
impl Default for PageLayout
Source§fn default() -> PageLayout
fn default() -> PageLayout
impl Eq for PageLayout
Source§impl PartialEq for PageLayout
impl PartialEq for PageLayout
impl StructuralPartialEq for PageLayout
Auto Trait Implementations§
impl Freeze for PageLayout
impl RefUnwindSafe for PageLayout
impl Send for PageLayout
impl Sync for PageLayout
impl Unpin for PageLayout
impl UnsafeUnpin for PageLayout
impl UnwindSafe for PageLayout
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.