Fix rebuild when deleting a content adapter file · gohugoio/hugo@87e100e (original) (raw)
`@@ -308,6 +308,45 @@ func TestPagesFromGoTmplRemoveGoTmpl(t *testing.T) {
`
308
308
`b.AssertFileContent("public/docs/index.html", "RegularPagesRecursive: pfile:/docs/pfile|$")
`
309
309
`}
`
310
310
``
``
311
`+
func TestPagesFromGoTmplEditOverlappingContentFile(t *testing.T) {
`
``
312
`+
t.Parallel()
`
``
313
`` +
files := `
``
``
314
`+
-- hugo.toml --
`
``
315
`+
disableLiveReload = true
`
``
316
`+
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
`
``
317
`+
-- layouts/all.html --
`
``
318
`+
All: {{ .Content }}|{{ .Title }}|
`
``
319
`+
-- layouts/section.html --
`
``
320
`+
Title: {{ .Title}}|
`
``
321
`+
RegularPages: {{ range .RegularPages }}{{ .Title }}:{{ .Path }}|{{ end }}|
`
``
322
`+
-- content/mysection/_index.md --
`
``
323
`+
`
``
324
`+
title: "My Section"
`
``
325
`+
`
``
326
`+
-- content/mysection/p1.md --
`
``
327
`+
`
``
328
`+
title: "p1 content file"
`
``
329
`+
`
``
330
`+
Content of p1
`
``
331
`+
-- content/_content.gotmpl --
`
``
332
`+
{{ $.AddPage (dict "kind" "page" "path" "mysection/p2" "title" "p2 content adapter") }}
`
``
333
`` +
`
``
``
334
`+
b := hugolib.TestRunning(t, files)
`
``
335
`+
b.AssertFileContent("public/mysection/index.html", "Title: My Section|", "RegularPages: p1 content file:/mysection/p1|p2 content adapter:/mysection/p2|")
`
``
336
+
``
337
`` +
b.EditFileReplaceAll("content/mysection/p1.md", "p1 content file", "p1 content file edited").Build()
``
``
338
`+
b.AssertFileContent("public/mysection/index.html", "RegularPages: p1 content file edited:/mysection/p1|p2 content adapter:/mysection/p2|")
`
``
339
+
``
340
`+
b.EditFileReplaceAll("content/mysection/_index.md", "My Section", "My Section edited").Build()
`
``
341
`+
b.AssertFileContent("public/mysection/index.html", "Title: My Section edited|", "RegularPages: p1 content file edited:/mysection/p1|p2 content adapter:/mysection/p2|")
`
``
342
+
``
343
`+
b.RemoveFiles("content/mysection/p1.md").Build()
`
``
344
`+
b.AssertFileContent("public/mysection/index.html", "Title: My Section edited|\nRegularPages: p2 content adapter:/mysection/p2|")
`
``
345
+
``
346
`+
b.RemoveFiles("content/_content.gotmpl", "public/mysection/index.html").Build()
`
``
347
`+
b.AssertFileContent("public/mysection/index.html", "Title: My Section edited|\nRegularPages: |")
`
``
348
`+
}
`
``
349
+
311
350
`// Issue #13443.
`
312
351
`func TestPagesFromGoRelatedKeywords(t *testing.T) {
`
313
352
`t.Parallel()
`