mojoPortal 220.127.116.11 brings you the Blog Post List Module.
In the past the only way to show select blog posts on another page was to use the Feed Module and pull in posts from the blog via that blog’s RSS feed. Not only was this heavy for the page load, but it was also unwieldy for the developer customize and wouldn’t update immediately.
We needed a new solution: a module that would pull in the blog posts and offer the ability to customize the look of those posts.
Using the Module
To use the Blog Post List Modele add it to a page, then go to that module’s setting and set the "Blog Instance" to the blog you want to pull from.
Now select the View you want to use, the “Please Select” view is the same as the “Default” view. Views are
.cshtml files with the Razor templating in them, you can make your own very easily to change the way the posts render, more on that later.
Number of items to render does what it says, determines how many items render out. Pagination is not available at this time.
Now save and you should see the post items rendered out.
The Blog Post List Module supports the Blog Featured Post and the Blog Featured Image features.
Creating or Modifying a View
For a while now, we at i7MEDIA have been playing with using Razor templating (the templating used in ASP.NET MVC) with mojoPortal to make better customization a reality, and this is our first product built that way.
The best way to get started with a new view for the Blog Post List Module is to copy the default view. The default view is located at
\Views\Blog\_BlogPostList.cshtml. We also have two more views in Framework, 2 Column and 3 Column. You could start with one of those. The steps below will help you get going:
- Create a new folder in the root of your skin folder named "Views" and then create another new folder inside of that named "Blog". You should now have a folder at
- Copy the default view from
\wwwroot\Data\Sites\[SiteNumber]\skins\[YourSkin]\Views\Blog\_BlogPostList--MyViewName.cshtml . You will notice, we added
--MyViewName to the name of the view. You can change this to whatever you like, just be sure you keep the two dashes.
- Open the view located inside of your skin with your favorite text editor.
- Edit the razor view however you'd like. You can learn more about Razor here: https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages/?tabs=visual-studio
- If you're wondering about your model, you have access to two models inside your views, outlines for which can be found here: https://github.com/i7MEDIA/mojoportal/blob/master/mojoPortal.Features.Business/Blog/BlogPostModel.cs and here: https://github.com/i7MEDIA/mojoportal/blob/master/mojoPortal.Features.Business/Blog/PostListModel.cs
- Click "settings" on your published module, and select your new view from the "View" dropdown.