From be72cf81903dc61fc13cb99942343e36b033531e Mon Sep 17 00:00:00 2001 From: Kai O'Reilly Date: Mon, 22 Jul 2024 12:44:44 -0700 Subject: [PATCH] delete pages that still need a path after everything has been created --- pages/page.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pages/page.go b/pages/page.go index e2e08766f6..b17849230c 100644 --- a/pages/page.go +++ b/pages/page.go @@ -100,7 +100,7 @@ func (pg *Page) Init() { rawURL = strings.TrimPrefix(rawURL, "/") filename := "" dirPath, ok := pg.URLToPagePath[path.Dir(rawURL)] - if ok && dirPath != needsPath { + if ok { filename = path.Join(path.Dir(dirPath), path.Base(rawURL)) } else { filename = rawURL @@ -208,6 +208,13 @@ func (pg *Page) Init() { } return nil })) + // If we still need a path, we shouldn't exist. + for u, p := range pg.URLToPagePath { + if p == needsPath { + delete(pg.URLToPagePath, u) + w.FindPath(u).AsTree().Delete() + } + } // open the default page if there is no currently open page if pg.PagePath == "" { if getWebURL != nil {