}
return wasDeleted, isEmpty
case *resourceSource:
- if lidx > 0 {
+ if lidx != v.LangIndex() {
return false, false
}
resource.MarkStale(v)
return true, true
case *pageState:
- if lidx > 0 {
+ if lidx != v.s.languagei {
return false, false
}
resource.MarkStale(v)
if len(keys) == 0 {
return nil
}
+
sa.pageMap.DeletePageAndResourcesBelow(keys...)
return nil
// See the License for the specific language governing permissions and
// limitations under the License.
-package hugolib_test
+package hugolib
import (
"strings"
"testing"
-
- "github.com/gohugoio/hugo/hugolib"
)
// Issue 9793
{{ .Title }}
`
- b := hugolib.Test(t, files)
+ b := Test(t, files)
b.AssertFileContent("public/section-1/index.html", "Section-1s")
b.AssertFileContent("public/tags/index.html", "Tags")
files = strings.Replace(files, "true", "false", -1)
- b = hugolib.Test(t, files)
+ b = Test(t, files)
b.AssertFileContent("public/section-1/index.html", "section-1")
b.AssertFileContent("public/tags/index.html", "tags")
b.AssertFileContent("public/tags/tag-a/index.html", "tag-a")
}
+
+func TestDraftNonDefaultContentLanguage(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+defaultContentLanguage = "en"
+[languages]
+[languages.en]
+weight = 1
+[languages.nn]
+weight = 2
+-- content/p1.md --
+-- content/p2.nn.md --
+---
+title: "p2"
+draft: true
+---
+-- layouts/_default/single.html --
+{{ .Title }}
+`
+ b := Test(t, files)
+
+ b.AssertFileExists("public/nn/p2/index.html", false)
+}