Skip to content

Commit

Permalink
delete pages that still need a path after everything has been created
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Jul 22, 2024
1 parent 74d19ec commit be72cf8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pages/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit be72cf8

Please sign in to comment.