In this section, we will be doing a couple of different things. One we want to make it so that the images show if there is an image on the post:
We also want to truncate the text because right now if we have a long post it's will show the whole body and we don't want that we want to just show a portion of it and then click Read More
, that'll go to a single post page. We also want to make it so that when we click on Category
it'll show all the posts in that category.
So what I'm will do first is I'm will get rid of all these posts and we will start fresh. So I'm in the Mongo shell and I'm will say db.posts.remove
and then we're just will pass in some empty curly braces, so that's will remove everything:
So if we reload we have nothing here, so let's go ahead and since we not we don't have our messages set up so we can do that:
After we add a category we want to have a message, let's see, which it should be doing because we have this:
req.flash('success', 'Category...