mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge pull request #437 from xini/feature-prev-next
add meta links for previous and next pages in paging and post view
This commit is contained in:
commit
35cbc20d5f
@ -760,7 +760,6 @@ class Blog_Controller extends Page_Controller
|
|||||||
|
|
||||||
if ($year) {
|
if ($year) {
|
||||||
$this->blogPosts = $dataRecord->getArchivedBlogPosts($year, $month, $day);
|
$this->blogPosts = $dataRecord->getArchivedBlogPosts($year, $month, $day);
|
||||||
|
|
||||||
return $this->render();
|
return $this->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,7 +839,7 @@ class Blog_Controller extends Page_Controller
|
|||||||
if($this->isRSS()) {
|
if($this->isRSS()) {
|
||||||
return $this->rssFeed($this->blogPosts, $tag->getLink());
|
return $this->rssFeed($this->blogPosts, $tag->getLink());
|
||||||
} else {
|
} else {
|
||||||
return $this->render();
|
return $this->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,7 +885,7 @@ class Blog_Controller extends Page_Controller
|
|||||||
if($this->isRSS()) {
|
if($this->isRSS()) {
|
||||||
return $this->rssFeed($this->blogPosts, $category->getLink());
|
return $this->rssFeed($this->blogPosts, $category->getLink());
|
||||||
} else {
|
} else {
|
||||||
return $this->render();
|
return $this->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,7 +1048,37 @@ class Blog_Controller extends Page_Controller
|
|||||||
|
|
||||||
return $posts;
|
return $posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the absolute link to the next page for use in the page meta tags. This helps search engines
|
||||||
|
* find the pagination and index all pages properly.
|
||||||
|
*
|
||||||
|
* @example "<% if $PaginationAbsoluteNextLink %><link rel="next" href="$PaginationAbsoluteNextLink"><% end_if %>"
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function PaginationAbsoluteNextLink() {
|
||||||
|
$posts = $this->PaginatedList();
|
||||||
|
if ($posts->NotLastPage()) {
|
||||||
|
return Director::absoluteURL($posts->NextLink());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the absolute link to the previous page for use in the page meta tags. This helps search engines
|
||||||
|
* find the pagination and index all pages properly.
|
||||||
|
*
|
||||||
|
* @example "<% if $PaginationAbsolutePrevLink %><link rel="prev" href="$PaginationAbsolutePrevLink"><% end_if %>"
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function PaginationAbsolutePrevLink() {
|
||||||
|
$posts = $this->PaginatedList();
|
||||||
|
if ($posts->NotFirstPage()) {
|
||||||
|
return Director::absoluteURL($posts->PrevLink());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays an RSS feed of blog posts.
|
* Displays an RSS feed of blog posts.
|
||||||
*
|
*
|
||||||
@ -1134,4 +1163,5 @@ class Blog_Controller extends Page_Controller
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user