Reset translation slice on rebuild
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 25 Jul 2016 21:38:37 +0000 (23:38 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 6 Sep 2016 15:32:16 +0000 (18:32 +0300)
Also add all translations, including the current, to the slice. We filter later.

hugolib/site.go
hugolib/translations.go

index ff67eb48ab421a7880dac1db2439ebc43be798a5..b2a9161f48e769b3da8d0495b753305281e11975 100644 (file)
@@ -2048,12 +2048,6 @@ func (s *Site) renderAndWritePage(name string, dest string, d interface{}, layou
                return err
        }
 
-       if renderBuffer.Len() == 0 {
-               if p, ok := d.(*Page); ok {
-                       fmt.Println(">>>>", p.Lang(), len(p.Content))
-               }
-       }
-
        outBuffer := bp.GetBuffer()
        defer bp.PutBuffer(outBuffer)
 
index 7caa6b4364ac7a21484f0f74f9396f94ae4bd7d1..724f6a5941bbf31580498115e4e1a9f8683388f7 100644 (file)
@@ -55,6 +55,7 @@ func pagesToTranslationsMap(ml *Multilingual, pages []*Page) map[string]Translat
 
 func assignTranslationsToPages(allTranslations map[string]Translations, pages []*Page) {
        for _, page := range pages {
+               page.translations = page.translations[:0]
                base := page.TranslationBaseName()
                trans, exist := allTranslations[base]
                if !exist {
@@ -63,9 +64,6 @@ func assignTranslationsToPages(allTranslations map[string]Translations, pages []
 
                // TODO(bep) multilingo remove lang
                for _, translatedPage := range trans {
-                       if translatedPage == page {
-                               continue
-                       }
                        page.translations = append(page.translations, translatedPage)
                }