pub struct Source<SourceMeta = (), EntryMeta = ()>{
pub title: String,
pub root: PathBuf,
pub origin: String,
pub prefix: String,
pub entries: Vec<Entry<EntryMeta>>,
pub static_entries: Vec<StaticEntry>,
pub stylesheets: Vec<PathBuf>,
pub javascript: Vec<PathBuf>,
pub icon: Option<PathBuf>,
pub well_known: Option<PathBuf>,
pub meta: SourceMeta,
}Expand description
The Source object reads and interprets a source directory.
The fields are intentionally public. Feel free to manually generate or modify this structure.
Fields§
§title: StringThe website’s title.
By default, this field is read from gazetta.yaml.
root: PathBufThe source root directory.
This is specified on construction.
origin: StringThe website origin (http://mydomain.com:1234)
By default, this field is derived from the value of base in gazetta.yaml.
prefix: StringThe directory under the origin at which this site will be hosted (e.g. “/”).
By default, this field is derived from the value of base in gazetta.yaml.
entries: Vec<Entry<EntryMeta>>The website content to be rendered.
By default, this list is populated with Entries generated from files with the basename index under the root directory excluding:
-
Files under directories named “static”.
-
Files under
assets/.
static_entries: Vec<StaticEntry>The website content to be deployed as-is (no rendering).
By default, this list is populated with directories under the root directory named “static” excluding:
-
Directories under directories named “static”.
-
Directories under
assets/.
stylesheets: Vec<PathBuf>The website stylesheets. When rendered, these will be concatenated into a single stylesheet.
By default, this list is populated by the files in is assets/stylesheets/ in
lexicographical order.
javascript: Vec<PathBuf>The website javascript. When rendered, these will be concatenated into a single javascript file.
By default, this list is populated by the files in is assets/javascript/ in
lexicographical order.
icon: Option<PathBuf>The path to the website’s icon.
By default, this points to assets/icon.png (if it exists).
well_known: Option<PathBuf>The path to the .well-known directory.
By default, this points to .well-known.
meta: SourceMetaAdditional metadata read from gazetta.yaml.
Implementations§
Source§impl<SourceMeta, EntryMeta> Source<SourceMeta, EntryMeta>
impl<SourceMeta, EntryMeta> Source<SourceMeta, EntryMeta>
Sourcepub fn index<'a>(
&'a self,
) -> Result<IndexedSource<'a, SourceMeta, EntryMeta>, SourceError>
pub fn index<'a>( &'a self, ) -> Result<IndexedSource<'a, SourceMeta, EntryMeta>, SourceError>
Build the IndexedSource for this Source.
Sourcepub fn new<P: AsRef<Path>>(root: P) -> Result<Self, AnnotatedError<SourceError>>
pub fn new<P: AsRef<Path>>(root: P) -> Result<Self, AnnotatedError<SourceError>>
Parse a source directory to create a new source.
Sourcepub fn reload(&mut self) -> Result<(), AnnotatedError<SourceError>>
pub fn reload(&mut self) -> Result<(), AnnotatedError<SourceError>>
Reload from the source directory.
Call this after changing source files.