diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index 8287c0129..e3e38d640 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -397,7 +397,7 @@ impl Site { /// Add a page to the site /// The `render` parameter is used in the serve command with --fast, when rebuilding a page. pub fn add_page(&mut self, mut page: Page, render_md: bool) -> Result<()> { - for (taxa_name, _) in &page.meta.taxonomies { + for taxa_name in page.meta.taxonomies.keys() { if !self.config.has_taxonomy(taxa_name, &page.lang) { bail!( "Page `{}` has taxonomy `{}` which is not defined in config.toml", diff --git a/components/site/src/link_checking.rs b/components/site/src/link_checking.rs index 070f699f2..899b01a22 100644 --- a/components/site/src/link_checking.rs +++ b/components/site/src/link_checking.rs @@ -51,18 +51,22 @@ pub fn check_internal_links_with_anchors(site: &Site) -> Result<()> { // as well as any other sring containing "_index." which is now referenced as // unsupported page path in the docs. if md_path.contains("_index.") { - let section = library.sections.get(&full_path).expect(&format!( - "Couldn't find section {} in check_internal_links_with_anchors from page {:?}", - md_path, - page.strip_prefix(&site.base_path).unwrap() - )); + let section = library.sections.get(&full_path).unwrap_or_else(|| { + panic!( + "Couldn't find section {} in check_internal_links_with_anchors from page {:?}", + md_path, + page.strip_prefix(&site.base_path).unwrap() + ) + }); !section.has_anchor(anchor) } else { - let page = library.pages.get(&full_path).expect(&format!( - "Couldn't find page {} in check_internal_links_with_anchors from page {:?}", - md_path, - page.strip_prefix(&site.base_path).unwrap() - )); + let page = library.pages.get(&full_path).unwrap_or_else(|| { + panic!( + "Couldn't find page {} in check_internal_links_with_anchors from page {:?}", + md_path, + page.strip_prefix(&site.base_path).unwrap() + ) + }); !(page.has_anchor(anchor) || page.has_anchor_id(anchor)) }