diff --git a/src/Model/Blog.php b/src/Model/Blog.php index fde1c84..fa2c936 100644 --- a/src/Model/Blog.php +++ b/src/Model/Blog.php @@ -6,6 +6,7 @@ use Page; use Page_Controller; use SilverStripe\Blog\Admin\GridFieldCategorisationConfig; use SilverStripe\Blog\Forms\GridField\GridFieldConfig_BlogPost; +use SilverStripe\CMS\Controllers\RootURLController; use SilverStripe\Control\Controller; use SilverStripe\Control\RSS\RSSFeed; use SilverStripe\Core\Convert; @@ -569,7 +570,13 @@ class Blog extends Page implements PermissionProvider */ public function ProfileLink($urlSegment) { - return Controller::join_links($this->Link(), 'profile', $urlSegment); + $baseLink = $this->Link(); + if ($baseLink === '/') { + // Handle homepage blogs + $baseLink = RootURLController::get_homepage_link(); + } + + return Controller::join_links($baseLink, 'profile', $urlSegment); } /** diff --git a/src/Model/BlogPost.php b/src/Model/BlogPost.php index 72b5be8..9e70df0 100644 --- a/src/Model/BlogPost.php +++ b/src/Model/BlogPost.php @@ -637,7 +637,7 @@ class BlogPost extends Page */ public function getCredits() { - $list = new ArrayList(); + $list = ArrayList::create(); $list->merge($this->getDynamicCredits()); $list->merge($this->getStaticCredits()); diff --git a/src/Model/Blog_Controller.php b/src/Model/Blog_Controller.php index 81a5ca4..bd5e9b3 100644 --- a/src/Model/Blog_Controller.php +++ b/src/Model/Blog_Controller.php @@ -69,7 +69,7 @@ class Blog_Controller extends Page_Controller /** * Renders a Blog Member's profile. * - * @return SS_HTTPResponse + * @return HTTPResponse */ public function profile() { diff --git a/templates/Includes/EntryMeta.ss b/templates/Includes/EntryMeta.ss index 197ed74..8100f21 100644 --- a/templates/Includes/EntryMeta.ss +++ b/templates/Includes/EntryMeta.ss @@ -1,31 +1,39 @@ -
+ diff --git a/tests/BlogTest.php b/tests/BlogTest.php index 1eeaab0..f02e96c 100755 --- a/tests/BlogTest.php +++ b/tests/BlogTest.php @@ -1,6 +1,6 @@ objFromFixture('SilverStripe\\Blog\\Model\\Blog', 'FirstBlog'); - $controller = new BlogController($blog); + $controller = new Blog_Controller($blog); $this->requestURL($controller, 'first-post/archive/'); $this->assertEquals(2013, $controller->getArchiveYear(), 'getArchiveYear should return 2013'); } @@ -287,7 +287,7 @@ class BlogTest extends SapphireTest public function testFilteredCategories() { $blog = $this->objFromFixture('SilverStripe\\Blog\\Model\\Blog', 'FirstBlog'); - $controller = new BlogController($blog); + $controller = new Blog_Controller($blog); // Root url $this->requestURL($controller, 'first-post');