Browse Source

Removed latest blog posts from main page due to possibility of spam/abuse incentive

master
Teknikode 3 years ago
parent
commit
22527e3fb2

+ 0
- 9
Teknik/Areas/Home/Controllers/HomeController.cs View File

@@ -33,14 +33,6 @@ namespace Teknik.Areas.Home.Controllers
if (foundSite != null)
lastSite = foundSite.ToList();
}
// Grab the latest user blog posts
List<BlogPost> lastPosts = new List<BlogPost>();
if (db.BlogPosts.Count() > 0)
{
var foundPosts = db.BlogPosts.OrderByDescending(post => post.DatePosted).Where(p => p.Published && !p.System).Take(5);
if (foundPosts != null)
lastPosts = foundPosts.ToList();
}
// Grab the latest podcasts
List<Podcast.Models.Podcast> lastPods = new List<Podcast.Models.Podcast>();
if (db.Podcasts.Count() > 0)
@@ -52,7 +44,6 @@ namespace Teknik.Areas.Home.Controllers

model.SitePosts = lastSite;
model.Podcasts = lastPods;
model.BlogPosts = lastPosts;

ViewBag.Title = Config.Title;
return View(model);

+ 0
- 1
Teknik/Areas/Home/ViewModels/HomeViewModel.cs View File

@@ -13,6 +13,5 @@ namespace Teknik.Areas.Home.ViewModels
{
public List<BlogPost> SitePosts { get; set; }
public List<Podcast.Models.Podcast> Podcasts { get; set; }
public List<BlogPost> BlogPosts { get; set; }
}
}

+ 2
- 43
Teknik/Areas/Home/Views/Home/Index.cshtml View File

@@ -128,7 +128,7 @@
<br />
<div class="container">
<!-- Display Site News -->
<div class="col-sm-4">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><span class="pull-left"><i class="fa fa-newspaper-o"></i></span><span class="center-block text-center">Recent News</span></h3>
@@ -170,7 +170,7 @@
</div>
</div>
<!-- Display Recent Podcasts -->
<div class="col-sm-4">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><span class="pull-left"><i class="fa fa-microphone"></i></span><span class="center-block text-center">Recent Podcasts</span></h3>
@@ -211,45 +211,4 @@
</div>
</div>
</div>
<!-- Display Recent Blog Posts -->
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><span class="pull-left"><i class="fa fa-book"></i></span><span class="center-block text-center">Recent Blog Posts</span></h3>
</div>
<div class="panel-body">
<ul class="list-group">
@if (Model.BlogPosts.Any())
{
foreach (BlogPost post in Model.BlogPosts)
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = post.Blog.User.Username, id = post.BlogPostId })" id="title_@post.BlogPostId">@Html.Markdown(post.Title)</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@post.DatePosted.ToString("s")">@post.DatePosted.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("user", "User.ViewProfile", new { username = post.Blog.User.Username })">@post.Blog.User.Username</a>
</p>
</div>
</div>
</div>
</li>
}
}
else
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12 text-center">
<h4>No Posts Available</h4>
</div>
</div>
</li>
}
</ul>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save