# Re: How to get "Read More" link

**URL:** <https://www.ruby-forum.com/t/re-how-to-get-read-more-link/74192>\
**Category:** Typo\
**Created:** [February 27, 2006, 4:37pm UTC](https://www.ruby-forum.com/t/re-how-to-get-read-more-link/74192 "2006-02-27T16:37:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/6bbea6/32.png) [@Paul\_I](https://www.ruby-forum.com/u/Paul_I)\
**Post date:** [February 27, 2006, 4:37pm UTC](https://www.ruby-forum.com/t/re-how-to-get-read-more-link/74192/1 "2006-02-27T16:37:55Z")

</div>

Well, there’s the extended content box - anything placed in which will  
ordinarily only be viewable when clicking to view a post.

Although my current theme (hemingway from the Typogarden contest)  
doesn’t really make it abundantly clear that there is more content to  
follow - I’ve resorted to just wording the normal text to indicate  
there’s more, then the user can click the usual links to make their way  
through to the post.

Paul

* * *

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Vamsee K.  
Sent: 27 February 2006 15:18  
To: removed\_email\_address@domain.invalid  
Subject: [typo] How to get “Read More” link

Hi all,

Is there anyway I can limit the number of words in a given entry? Like,  
show them a little description, followed by a link “Read More”.  
Clicking on which will lead to the actual article. Sorry if this has  
been asked before, I couldn’t find anything on the archives.

Thanks,  
Vamsee.

This email and any attachments are confidential. They may contain  
privileged information and are intended for the named addressee(s) only.  
They must not be distributed without Perfect Information’s consent. If  
you are not the intended recipient, please notify us immediately and do  
not disclose, distribute, or retain this email or any part of it. Unless  
expressly stated, opinions in this email are those of the individual  
sender, and not of Perfect Information. We believe but do not warrant  
that this e-mail and any attachments do not contain any form of virus.  
You must therefore take full responsibility for virus checking. Perfect  
Information reserves the right to monitor all email communications  
through their networks.

---

<div class="post-metadata">

**Author:** ![Paul\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/6bbea6/32.png) [@Paul\_I](https://www.ruby-forum.com/u/Paul_I)\
**Post date:** [February 28, 2006, 12:01am UTC](https://www.ruby-forum.com/t/re-how-to-get-read-more-link/74192/2 "2006-02-28T00:01:17Z")

</div>

Actually, I?ve done this on my blog ([http://uzair.nairang.org](http://uzair.nairang.org)), and it?s  
fairly simple. The tricky thing is that when you truncate the article on  
the  
front page, you have to sanitize the HTML and close any open tags, so  
that  
you don?t get inconsistent formatting because of, say, an open italics  
tag.

In my themes/hemingway/articles/index.rhtml, I?ve got this (lines 9-14):

```
<div class="story<%= ' first' if i == 1 %>">
	<h3><%= article_link article.title, article %></h3>
	<%= truncate(article.body_html, 500) %>
	<div class="details">
		Posted at <%= article.created_at.strftime("%I").to_i
	</div>
</div>

```

The truncate() call returns just the first 500 characters of the  
article,  
sanitizing it first. I put the sanitizing function in  
app/helpers/application\_helper.rb, since that’s where the strip\_html()  
function etc. are. If you like, I can send you my copy.

Cheers,

Uzair

* * *

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Paul I.  
Sent: Monday, February 27, 2006 3:35 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [typo] How to get “Read More” link

Well, there?s the extended content box ? anything placed in which will  
ordinarily only be viewable when clicking to view a post.

Although my current theme (hemingway from the Typogarden contest)  
doesn?t  
really make it abundantly clear that there is more content to follow ?  
I?ve  
resorted to just wording the normal text to indicate there?s more, then  
the  
user can click the usual links to make their way through to the post.

Paul

* * *

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Vamsee K.  
Sent: 27 February 2006 15:18  
To: removed\_email\_address@domain.invalid  
Subject: [typo] How to get “Read More” link

Hi all,

Is there anyway I can limit the number of words in a given entry? Like,  
show  
them a little description, followed by a link “Read More”. Clicking on  
which will lead to the actual article. Sorry if this has been asked  
before,  
I couldn’t find anything on the archives.

Thanks,  
Vamsee.

This email and any attachments are confidential. They may contain  
privileged  
information and are intended for the named addressee(s) only. They must  
not  
be distributed without Perfect Information’s consent. If you are not the  
intended recipient, please notify us immediately and do not disclose,  
distribute, or retain this email or any part of it. Unless expressly  
stated,  
opinions in this email are those of the individual sender, and not of  
Perfect Information. We believe but do not warrant that this e-mail and  
any  
attachments do not contain any form of virus. You must therefore take  
full  
responsibility for virus checking. Perfect Information reserves the  
right to  
monitor all email communications through their networks.
