aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/content_map_page.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-22 15:06:42 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-22 16:16:44 +0100
commitdb3bb623d4acd150768998bb1952b5399e3fa47c (patch)
tree8260f957786956391d17f656f27b85dbf9ece9fb /hugolib/content_map_page.go
parentf5fd7ec8ccc1e2e325aa9b5ba94bbb36167a41a3 (diff)
downloadhugo-db3bb623d4acd150768998bb1952b5399e3fa47c.tar.gz
hugo-db3bb623d4acd150768998bb1952b5399e3fa47c.zip
Fix it so not all bundled resources are removed when one translation is drafted
Fixes #12105
Diffstat (limited to 'hugolib/content_map_page.go')
-rw-r--r--hugolib/content_map_page.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go
index 5f0b11210..ee7f22676 100644
--- a/hugolib/content_map_page.go
+++ b/hugolib/content_map_page.go
@@ -221,10 +221,22 @@ func (t pageTrees) Shape(d, v int) *pageTrees {
t.treePages = t.treePages.Shape(d, v)
t.treeResources = t.treeResources.Shape(d, v)
t.treeTaxonomyEntries = t.treeTaxonomyEntries.Shape(d, v)
+ t.createMutableTrees()
return &t
}
+func (t *pageTrees) createMutableTrees() {
+ t.treePagesResources = doctree.WalkableTrees[contentNodeI]{
+ t.treePages,
+ t.treeResources,
+ }
+
+ t.resourceTrees = doctree.MutableTrees{
+ t.treeResources,
+ }
+}
+
var (
_ resource.Identifier = pageMapQueryPagesInSection{}
_ resource.Identifier = pageMapQueryPagesBelowPath{}
@@ -676,9 +688,15 @@ func (s *contentNodeShifter) Delete(n contentNodeI, dimension doctree.Dimension)
}
return wasDeleted, isEmpty
case *resourceSource:
+ if lidx > 0 {
+ return false, false
+ }
resource.MarkStale(v)
return true, true
case *pageState:
+ if lidx > 0 {
+ return false, false
+ }
resource.MarkStale(v)
return true, true
default:
@@ -1694,6 +1712,9 @@ func (sa *sitePagesAssembler) removeShouldNotBuild() error {
return err
}
+ if len(keys) == 0 {
+ return nil
+ }
sa.pageMap.DeletePageAndResourcesBelow(keys...)
return nil