FAQ preview text

46 views
Skip to first unread message

Ric Paul

unread,
Mar 28, 2013, 12:42:00 PM3/28/13
to libra...@googlegroups.com
Hi,

Is there any way to specify the preview text used on the home page for the FAQs? I've written a few FAQ entries, some of which have lists or tables near the start - but that formatting isn't shown in the preview text, so it looks odd.

By the looks of it, the preview section strips out the HTML tags of the initial text, so I can't use styles to format it back as a list (please correct me if I'm wrong!) - so I'm left with having to keep lists or tables to after the first 400 characters of the FAQ entry.

Is there a way around this? Or would it be possible to either...

  • Have a tag that forces the end of the preview text, or
  • Have a separate field in the FAQ for the preview text (i.e. text that's shown in the preview, not on the FAQ entry itself, and which can therefore be different) (basically, a manual synopsis)
Thanks!

Ric.

LibraryH3lp Support

unread,
Mar 28, 2013, 2:21:39 PM3/28/13
to libraryh3lp
Dear Ric,

Yes, the preview text does not contain any HTML mark-up. It is just plan text. However, with a bit of template editing, I think you can achieve the desired effect. Here's one way to go about it...

Within your preview.html template, make this:

<p class="question-preview">
  {{ question.preview }}...
  <a class="question-popover pull-right" rel="popover" data-original-title="Answer" data-load="/questions/{{ question.id }}/answer" href="/questions/{{ question.id }}">read more <i class="icon-forward"></i></a>
</p>

look like this:

<p class="question-preview" style="overflow:hidden; height:75px;">
  {{ question.answer|safe }}
</p>
<a class="question-popover pull-right" rel="popover" data-original-title="Answer" data-load="/questions/{{ question.id }}/answer" href="/questions/{{ question.id }}">read more <i class="icon-forward"></i></a>

The second form uses the entire answer rather than just the preview. The "safe" filter allows for HTML markup. And the style on the "question-preview" paragraph controls the height of the area allowed for your answer and ensures that any extra content past that height is hidden.

Hope that helps,
Amy Shelton



Ric.

--
You received this message because you are subscribed to the Google Groups "libraryh3lp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libraryh3lp...@googlegroups.com.
To post to this group, send email to libra...@googlegroups.com.
Visit this group at http://groups.google.com/group/libraryh3lp?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages