From 0a7692ad85152a870fe5ed5cc2c24d681a1c7f72 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Thu, 24 Jun 2021 23:28:48 +0200 Subject: [PATCH] Exclude self from translation list for page/section Closes #1410 --- components/library/src/content/ser.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/library/src/content/ser.rs b/components/library/src/content/ser.rs index 83ab4964..53a2d571 100644 --- a/components/library/src/content/ser.rs +++ b/components/library/src/content/ser.rs @@ -33,6 +33,9 @@ impl<'a> TranslatedContent<'a> { .iter() { let other = library.get_section_by_key(*key); + if other.permalink == section.permalink { + continue; + } translations.push(TranslatedContent { lang: &other.lang, permalink: &other.permalink, @@ -51,6 +54,9 @@ impl<'a> TranslatedContent<'a> { library.translations.get(&page.file.canonical).or(Some(&HashSet::new())).unwrap().iter() { let other = library.get_page_by_key(*key); + if other.permalink == page.permalink { + continue; + } translations.push(TranslatedContent { lang: &other.lang, permalink: &other.permalink,