1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

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

This commit is contained in:
Uncled1023 2017-03-06 13:59:49 -08:00
parent f01bbc6b18
commit 22527e3fb2
3 changed files with 2 additions and 53 deletions

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);

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; }
}
}

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>