]> BookStack Code Mirror - bookstack/blobdiff - app/Page.php
Added indexes, Reduced queries on pages
[bookstack] / app / Page.php
index 25bb22f8a506e2e1ef40e1d8fae80d5047276a49..feedb1eae85812b27d814582cbd4e061de73faf6 100644 (file)
@@ -40,7 +40,9 @@ class Page extends Entity
 
     public function getUrl()
     {
-        return '/books/' . $this->book->slug . '/page/' . $this->slug;
+        // TODO - Extract this and share with chapters
+        $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug;
+        return '/books/' . $bookSlug . '/page/' . $this->slug;
     }
 
     public function getExcerpt($length = 100)