pub fn build(&self) -> Result<()> {
        // Do not clean on `zola serve` otherwise we end up copying assets all the time
        if self.build_mode == BuildMode::Disk {
            self.clean()?;
        }

        // Generate/move all assets before rendering any content
        if let Some(ref theme) = self.config.theme {
            let theme_path = self.base_path.join("themes").join(theme);
            if theme_path.join("sass").exists() {
                sass::compile_sass(&theme_path, &self.output_path)?;
            }
        }

        if self.config.compile_sass {
            sass::compile_sass(&self.base_path, &self.output_path)?;
        }

        if self.config.build_search_index {
            self.build_search_index()?;
        }

        // Render aliases first to allow overwriting
        self.render_aliases()?;
        self.render_sections()?;
        self.render_orphan_pages()?;
        self.render_sitemap()?;

        let library = self.library.read().unwrap();
        if self.config.generate_feed {
            let is_multilingual = self.config.is_multilingual();
            let pages = if is_multilingual {
                library
                    .pages_values()
                    .iter()
                    .filter(|p| p.lang == self.config.default_language)
                    .cloned()
                    .collect()
            } else {
                library.pages_values()
            };
            self.render_feed(pages, None, &self.config.default_language, |c| c)?;
        }

        for lang in &self.config.languages {
            if !lang.feed {
                continue;
            }
            let pages =
                library.pages_values().iter().filter(|p| p.lang == lang.code).cloned().collect();
            self.render_feed(pages, Some(&PathBuf::from(lang.code.clone())), &lang.code, |c| c)?;
        }

        self.render_404()?;
        self.render_robots()?;
        self.render_taxonomies()?;
        // We process images at the end as we might have picked up images to process from markdown
        // or from templates
        self.process_images()?;
        // Processed images will be in static so the last step is to copy it
        self.copy_static_directories()?;

        Ok(())
    }
/// Deletes the `public` directory (only for `zola build`) and builds the site
Deletes the `public` directory (only for `zola build`) and builds the site
Deletes the ` public ` directory ( only for ` zola build ` ) and builds the site
pub fn build(&self) -> Result<()> {
        // Do not clean on `zola serve` otherwise we end up copying assets all the time
        if self.build_mode == BuildMode::Disk {
            self.clean()?;
        }
        // Generate/move all assets before rendering any content
        if let Some(ref theme) = self.config.theme {
            let theme_path = self.base_path.join("themes").join(theme);
            if theme_path.join("sass").exists() {
                sass::compile_sass(&theme_path, &self.output_path)?;
            }
        }
        if self.config.compile_sass {
            sass::compile_sass(&self.base_path, &self.output_path)?;
        }
        if self.config.build_search_index {
            self.build_search_index()?;
        }
        // Render aliases first to allow overwriting
        self.render_aliases()?;
        self.render_sections()?;
        self.render_orphan_pages()?;
        self.render_sitemap()?;
        let library = self.library.read().unwrap();
        if self.config.generate_feed {
            let is_multilingual = self.config.is_multilingual();
            let pages = if is_multilingual {
                library
                    .pages_values()
                    .iter()
                    .filter(|p| p.lang == self.config.default_language)
                    .cloned()
                    .collect()
            } else {
                library.pages_values()
            };
            self.render_feed(pages, None, &self.config.default_language, |c| c)?;
        }
        for lang in &self.config.languages {
            if !lang.feed {
                continue;
            }
            let pages =
                library.pages_values().iter().filter(|p| p.lang == lang.code).cloned().collect();
            self.render_feed(pages, Some(&PathBuf::from(lang.code.clone())), &lang.code, |c| c)?;
        }
        self.render_404()?;
        self.render_robots()?;
        self.render_taxonomies()?;
        // We process images at the end as we might have picked up images to process from markdown
        // or from templates
        self.process_images()?;
        // Processed images will be in static so the last step is to copy it
        self.copy_static_directories()?;
        Ok(())
    }
pub fn build ( & self ) -> Result < ( ) > { // Do not clean on `zola serve` otherwise we end up copying assets all the time if self . build_mode == BuildMode :: Disk { self . clean ( ) ? ; } // Generate/move all assets before rendering any content if let Some ( ref theme ) = self . config . theme { let theme_path = self . base_path . join ( " " ) . join ( theme ) ; if theme_path . join ( " " ) . exists ( ) { sass :: compile_sass ( & theme_path , & self . output_path ) ? ; } } if self . config . compile_sass { sass :: compile_sass ( & self . base_path , & self . output_path ) ? ; } if self . config . build_search_index { self . build_search_index ( ) ? ; } // Render aliases first to allow overwriting self . render_aliases ( ) ? ; self . render_sections ( ) ? ; self . render_orphan_pages ( ) ? ; self . render_sitemap ( ) ? ; let library = self . library . read ( ) . unwrap ( ) ; if self . config . generate_feed { let is_multilingual = self . config . is_multilingual ( ) ; let pages = if is_multilingual { library . pages_values ( ) . iter ( ) . filter ( | p | p . lang == self . config . default_language ) . cloned ( ) . collect ( ) } else { library . pages_values ( ) } ; self . render_feed ( pages , None , & self . config . default_language , | c | c ) ? ; } for lang in & self . config . languages { if ! lang . feed { continue ; } let pages = library . pages_values ( ) . iter ( ) . filter ( | p | p . lang == lang . code ) . cloned ( ) . collect ( ) ; self . render_feed ( pages , Some ( & PathBuf :: from ( lang . code . clone ( ) ) ) , & lang . code , | c | c ) ? ; } self . render_404 ( ) ? ; self . render_robots ( ) ? ; self . render_taxonomies ( ) ? ; // We process images at the end as we might have picked up images to process from markdown // or from templates self . process_images ( ) ? ; // Processed images will be in static so the last step is to copy it self . copy_static_directories ( ) ? ; Ok ( ( ) ) }
Deletes the `public` directory (only for `zola build`) and builds the site
Deletes the ` public ` directory ( only for ` zola build ` ) and builds the site
&self
&self