So here's the final answer to the final challenge. 1
We know that in order to be able to render that read more page, we need an anchor tag right? 2
If we were to add our anchor tag inside our home.ejs let's try and do it here. 3
Let's add an anchor tag that simply says Read more. 4
And if I hit save and refresh then, you'll notice that I've got to read more 5
that shows up below my paragraph. 6
Now this might be what you want. 7
If so, then continue this way. 8
But if you wanted the read more to be on the same line as the paragraph tag, then you have to include 9
this anchor tag just before the end of the paragraph, 10
so somewhere here right? 11
And so let's separate out our paragraph tag into its two components. 12
One is that truncated bit of post content and the second one is going to be our anchor tag that will 13
take us to that post's individual page. 14
Now in order to do that, our anchor tag will need a link right? So will need an href. And the ref is going to 15
equal to the URL that will take us to the individual page. 16
Now we know that inside home.ejs we already have access to the post's title for each and every 17
post on the home page. 18
We already have access to this and we also know that we've set up our routes so that if we say posts 19
/ and we simply put in the name all the titles, so say Day 1 with a space in between 20
so this looks exactly the same as the title and we hit enter, we'll get taken to the page of that blog 21
post. 22
That means that our href can simply be /posts/ 23
the title of the post that we want to see. And to insert that we of course need our EJS tags, so angle 24
percentage equals and then percentage angle. And in-between we're just going to put a post.title. And 25
now we should be able to tap into that 26
URL /posts/the title of each and every post. 27
So now if I hit save and I refresh and I go back to my home page, then you can see I've now got this 28
Read more link next to each truncated post and when I click on it it shows me the individual pages of 29
the blog posts. 30
I hope you had fun in this challenge module. 31
I know it's pretty long but it goes through and re-affirms all of the things that we've learned up till 32
now. 33
And if you have completed this module without needing to look at a single hint or the answer, then you've 34
done really really well and you should be getting a gold star for your efforts and you can be pretty 35
confident that you've grasped all of the concepts up till now and you're ready to move on. 36
Now if you needed to look at a couple of the hints or if you needed to look at all the hints and even 37
the chances, I would recommend to give you a mind 38
a few days break and then to go through the challenge once more with fresh eyes and try to complete 39
it without using any of the hints. 40
This really is where you are going to improve and where you're going to level up. And I recommend to 41
give it some time and be patient and try to make sure that you've really made all of this knowledge 42
your own before you proceed. 43
So that's all from me and I look forward to seeing you in the next module.