Add blog index with pagination
This commit is contained in:
parent
68fa2cf1c7
commit
b8f371e3e8
5 changed files with 78 additions and 6 deletions
29
Website/Views/Blog/Page.cshtml
Normal file
29
Website/Views/Blog/Page.cshtml
Normal file
|
@ -0,0 +1,29 @@
|
|||
@model BlogViewModel;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Blog";
|
||||
}
|
||||
|
||||
@section ButtonsLeft {
|
||||
@if (Model.Page > 1) {
|
||||
<button onclick="window.location.href='/blog/page/@(Model.Page-1)'" title="Previous Page">
|
||||
<img src="/images/previous.svg" alt="Previous" />
|
||||
</button>
|
||||
}
|
||||
}
|
||||
@section ButtonsRight {
|
||||
@if (Model.Page < Model.MaxPages) {
|
||||
<button onclick="window.location.href='/blog/page/@(Model.Page+1)'" title="Next Page">
|
||||
<img src="/images/next.svg" alt="Next" />
|
||||
</button>
|
||||
}
|
||||
}
|
||||
|
||||
@foreach (var post in Model.Posts) {
|
||||
<article>
|
||||
<h2><a href="/blog/view/@post.Url">@post.Title</a></h2>
|
||||
@Html.Raw(post.Content)
|
||||
<small>Posted on @post.Timestamp.ToString()</small>
|
||||
<p><a href="/blog/view/@post.Url">Read more...</a></p>
|
||||
</article>
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue