With this trick, you can choose to display an arbitrary amount of text from the beginning of each post, as a teaser for the whole thing. Then users who want to read the rest of the post can click a link to see the full text. This is handy if you have lots of long articles all on one page. Note that you'll need to have post pages enabled in order to make this feature work.
There are three ingredients that go into this feature: conditional CSS, a "read more" link for each post, and a modification for the posts that use this feature. So let's go through it step by step.
Conditional CSS
We're going to use conditional tags to change how posts display on different pages. Add the following code to your style sheet, depending on what kind of template you have:
(for classic templates)
(for layouts)
Your style sheet is usually near the top of your template, between the <style> and </style> tags. If you have your style sheet in a separate file, you'll still need to add these lines in your template, so the conditional tags will work. Just make sure you add in the <style> tags around them.
What we did here was to define a class called "fullpost" that will appear only on post pages (permalinks). Part of each post will use this class, as we'll see later.
"Read More" Links
Add the following code to your template, somewhere after the
(for classic templates)<$BlogItemBody$> or <data:post.body/> tag:
(for layouts)
This link will only appear on the main page and archive pages, and it will redirect your reader to the post page containing the full text of your post. You can replace the "Read more!" text with whatever you like, of course.
Post Modifications
The final piece that we need is a little bit of code in your actual post. Each post that you want to use this feature on will need this code:
This part can actually go in the post template, if you don't want to have to type it for each post. You'll enter the summary text outside the span tags and the remainder inside, like so:
Now, when a reader visits your blog, this post will appear like this:
Here is the beginning of my post.When they click the link, they'll go to the post page where they'll see the whole thing:
Read more!
Here is the beginning of my post. And here is the rest of it.
Notes:
- As with any template modifications, you should be sure to save a backup copy of your template before you start. Just copy and paste all your code to a text file on your hard drive, so you'll have it there as a replacement in case anything goes wrong.
- An alternative to creating post excerpts like this is to use the show/hide method on entire posts. Each method has its own advantages and disadvantages.
- Advantages to this method: Customizable summaries, rather than titles only. Can be applied to some posts and not others (for instance, you might only want this for your longer posts).
- Disadvantages: Requires changes to the posts themselves, rather than to the template only. However, the "read more" link is in the template, so it will appear regardless of whether a post has been truncated or not. (Modifying this feature is left as an exercise for the reader.)
Daryl Lorette 12p · 893 weeks ago
eddy · 893 weeks ago
I really like the content you provide in the web page.
But you can do more with your web page spice up your page, don't stop providing the simple page you can provide more features like forums, polls, CMS,contact forms and many more features.
Convert your blog "yourname.blogspot.com" to www.yourname.com completely free.
free Blog services provide only simple blogs but we can provide free website for you where you can provide multiple services or features rather than only simple blog.
Become proud owner of the own site and have your presence in the cyber space.
we provide you free website+ free web hosting + list of your choice of scripts like(blog scripts,CMS scripts, forums scripts and may scripts) all the above services are absolutely free.
The list of services we provide are
1. Complete free services no hidden cost
2. Free websites like www.YourName.com
3. Multiple free websites also provided
4. Free webspace of1000 Mb / 1 Gb
5. Unlimited email ids for your website like (info@yoursite.com, contact@yoursite.com)
6. PHP 4.x
7. MYSQL (Unlimited databases)
8. Unlimited Bandwidth
9. Hundreds of Free scripts to install in your website (like Blog scripts, Forum scripts and many CMS scripts)
10. We install extra scripts on request
11. Hundreds of free templates to select
12. Technical support by email
Have nice day!
Get free website for your blog
wayne 1p · 893 weeks ago
web-businesses maybe you should have a look at my blog :)
Nomadicwade 1p · 893 weeks ago
donssite · 893 weeks ago
Thanks,
donssite.com learning to liftright.net at ezee.ca
Daryl Lorette 12p · 893 weeks ago
WishNoize · 893 weeks ago
Anchor text : Pas Society
Url : http://pasers.blogspot.com
akmalrizali 1p · 892 weeks ago
emma53 · 891 weeks ago
WebDiggin 1p · 891 weeks ago
WebDiggin 1p · 891 weeks ago
Blue Licorice · 888 weeks ago
desperateblogger · 886 weeks ago
Jenny 0p · 884 weeks ago
Lena · 884 weeks ago
DzeeShah · 882 weeks ago
Asep Rohman 0p · 876 weeks ago
J | Medical Lab Coat · 825 weeks ago
EasyMakesMoney · 811 weeks ago
sahoo79ngrh 1p · 766 weeks ago
sahoo79ngrh 1p · 766 weeks ago
Dave · 749 weeks ago
please add me to yours, thanks!
tomy blog · 722 weeks ago
alliv · 233 weeks ago