pub struct HeroShortcode {
pub image: Option<Url>,
pub extra_images: Vec<Url>,
pub attrs: String,
pub classes: String,
pub overlay: Vec<Block>,
pub overlay_text: String,
pub width: Option<String>,
pub mobile: Option<String>,
pub caption: String,
}Expand description
Arguments for Shortcode::Hero.
Fields§
§image: Option<Url>Primary image source URL. None if neither the image attribute
nor a leading body media line provided one — the renderer emits a
section with no <img> in that case. Flows through resolver before
rendering. With extra_images, this is the first slide and the
reduced-motion/static fallback.
extra_images: Vec<Url>Remaining background slides (2026-07-27 multi-image hero): every
consecutive leading body media line after the first. Non-empty →
the hero renders an ambient crossfade (one slide visible at a
time, no controls — no slide may carry information the others
don’t; design: docs/archive/2026-07-27-import-conventions-engine-design.md).
Empty for image=-attribute and directive-line heroes.
attrs: StringPipe-suffix media attributes verbatim (e.g. “cover top”, “1.5:1 contain”). Empty if no pipe in the source.
classes: StringExtra CSS classes for the wrapping <section> (from {.foo .bar}).
overlay: Vec<Block>Parsed block content for the overlay. Phase 4 PR4.5 (2026-05-28)
promoted this from overlay_markdown: String to overlay: Vec<Block>
(fully-typed AST). Nested shortcodes inside the overlay
(::::buttons inside :::hero) extract through
crate::ast::parser::parse recursion in
[crate::ast::shortcode_extract::parse_hero].
overlay_text: StringPlain-text overlay source for downstream OG-fallback extraction.
PR4.5 (2026-05-28): captured at parse time alongside the typed
overlay because crate::build::page::meta::extract_description
(the homepage-hero rung in the description chain) operates on
markdown source — round-tripping Vec<Block> to markdown would
invite drift. The renderer uses overlay for HTML; downstream
consumers read overlay_text for description-chain extraction.
Empty when the author wrote no overlay body.
TODO(phase4-cleanup): replace with a Vecto_plain_text(blocks: &[Block]) -> String helper in moss-core
- consume
overlaydirectly inmeta.rs::extract_description, deleting this field. Carrying bothoverlay: Vec<Block>ANDoverlay_text: Stringmakes the AST non-canonical (which is the source of truth?); per cross-SSG research, lossy or duplicate state is Gatsby’s mistake. This is transitional — flag if it survives past PR7a. (Architecture review caveat 2026-05-28.)
width: Option<String>Spec § P9 width attribute: body | wide | page | screen (with
full aliased to screen). None means the author did not set
a width — the emitter omits data-width so the HTML stays sparse.
mobile: Option<String>Mobile layout override. Some("overlay") keeps text overlaid on a
taller cropped image on mobile. None = default stacking behavior
(image full-width at natural ratio, text block below).
caption: StringCaption or credit for the image, from caption="…". Rendered as a
line of text BELOW the hero, never over it.
The overlay and the caption answer different questions. The overlay is text laid on the photograph — a title, a standfirst — and it is styled to be read against the image. A caption says what the photograph is and who took it, and printing that across someone’s picture is both unreadable and, for a credit, wrong: a photographer’s name has to survive as text, not as part of the composition. So a hero carrying a cover credit («封面:…(拍攝:…)») has somewhere to put it that is not on top of the subject.
A display string, rendered as inline markdown by the host — the same
treatment byline: / colophon: rows get — so a credit can be a link.
Empty when the author wrote no caption.
Trait Implementations§
Source§impl Clone for HeroShortcode
impl Clone for HeroShortcode
Source§fn clone(&self) -> HeroShortcode
fn clone(&self) -> HeroShortcode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HeroShortcode
impl Debug for HeroShortcode
Source§impl Default for HeroShortcode
impl Default for HeroShortcode
Source§fn default() -> HeroShortcode
fn default() -> HeroShortcode
Source§impl<'de> Deserialize<'de> for HeroShortcode
impl<'de> Deserialize<'de> for HeroShortcode
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>,
impl Eq for HeroShortcode
Source§impl PartialEq for HeroShortcode
impl PartialEq for HeroShortcode
Source§impl Serialize for HeroShortcode
impl Serialize for HeroShortcode
impl StructuralPartialEq for HeroShortcode
Auto Trait Implementations§
impl Freeze for HeroShortcode
impl RefUnwindSafe for HeroShortcode
impl Send for HeroShortcode
impl Sync for HeroShortcode
impl Unpin for HeroShortcode
impl UnsafeUnpin for HeroShortcode
impl UnwindSafe for HeroShortcode
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.