pub struct StaticSite { /* private fields */ }Expand description
A static site being assembled into an output directory. Pages are written as
index.html under a directory per path (so URLs are clean and extensionless),
static assets are copied verbatim, and StaticSite::finish writes a
sitemap.xml and robots.txt covering every page added.
Implementations§
Source§impl StaticSite
impl StaticSite
Sourcepub fn new(
out_dir: impl Into<PathBuf>,
base_url: impl Into<String>,
) -> Result<Self>
pub fn new( out_dir: impl Into<PathBuf>, base_url: impl Into<String>, ) -> Result<Self>
Prepares an output directory and records the site’s base URL (used for the
sitemap and robots entries), for example https://acme.example.
Sourcepub fn page(&mut self, path: &str, html: &str) -> Result<&mut Self>
pub fn page(&mut self, path: &str, html: &str) -> Result<&mut Self>
Writes a page’s rendered html for the URL path. The path maps to a
clean-URL file: / becomes index.html, /features/ becomes
features/index.html. The page is recorded for the sitemap.
Auto Trait Implementations§
impl Freeze for StaticSite
impl RefUnwindSafe for StaticSite
impl Send for StaticSite
impl Sync for StaticSite
impl Unpin for StaticSite
impl UnsafeUnpin for StaticSite
impl UnwindSafe for StaticSite
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