4

I have Drupal 7.7 + WYSIWYG 7.x-2.1 + CKEDITOR 3.6.1 installed.

My goal is to be able to insert a teaser break into my blog posts (blog post content type - body field), in order to specify what goes into the teaser and what goes into the full node view.

When I click the "Separate the teaser and body of this content" button in the CK EDITOR menu bar, the text <!--break--> is automatically inserted into my body field. However, this break is not having any effect on the text that remains in the teaser view vs. on the full node view. It simply doesn't seem to be working. I tried using TinyMCE and I had the same problem

Can anybody please advise on how can I get this function working?

Thanks!

---More details about my current setup: ----------------

In the CK editor profile for "Filtered HTML" - in the "CLEANUP AND OUTPUT OPTIONS", the following options are enabled: - Verify HTML - Convert tags to styles - Remove linebreaks

These options are not enabled: - Preformatted - Apply source formatting - Force cleanup on standard paste

2
  • HTML comments get removed, and this is a comment. There's a patch at drupal.org/node/881006#comment-5628078 that will result in the <!--break--> content coming through, although there are then other issues with CKEditor at least in that it sticks the break inside a <p> leaving a hanging open <p>. Humph Commented Feb 20, 2012 at 18:18
  • In case it suits your needs just to have one WYSIWYG editor, you should definitely try the regular CKEditor module too. With it, you can define different profiles for different text formats, and enable a teaser break button in the text editor, and there's no problem with the Filtered HTML text format, teaser break does its job correctly.
    – Sk8erPeter
    Commented Sep 13, 2013 at 8:11

5 Answers 5

0

Switch to Full HTML. I don't believe Teaser Breaks are allowed in Filtered HTML.

More info in link http://old.nabble.com/Wysiwyg-Frustrations%3A-My-Approach%2C-What-is-Yours-to31984379.html#a31984379

1
  • Full HTML has security risks (as your link says) :-( There's no reason Teasers Breaks aren't allowed in Filtered HTML, although some users have reported having to enable comments in the HTML filter. Commented Feb 20, 2012 at 18:28
6

Adding <!--> to the set of allowed HTML tags for the Filtered HTML format solved this problem for me. To do so, these are the steps to be performed:

  • Navigate to admin/config/content/formats/filtered_html.
  • Within "Filter settings", select the "Limit allowed HTML tags".
  • Within the field with label "Allowed HTML tags", add the string <!--> (in addition to whatever set of HTML tags you already have).
  • Save configuration.
2
  • 1
    Please review the improvement I added to your answer (by adding the steps to be performed, and improving the formatting of the actual string). If you don't like my edit at all, just perform a rollback. BTW, I think this answer is the best possible answer to the question asked here (just a rather standard configuration change, no patching or whatever needed, and of course it works). Commented Oct 24, 2017 at 10:52
  • This answer should be marked as the correct answer as OP is asking for a solution using the filtered HTML, which is the case. Indeed using Full HTML solves this problem, but is not always opportune.
    – Apoc
    Commented Mar 26, 2019 at 18:02
1

Have you considered just putting your desired teaser into the Summary (under Edit Summary) instead? It may be a more convenient workaround than trying to set up the Teaser Break.

1
  • But in case you change the teaser, and you want it to appear in both the teaser and the full content, you have to change it in both places, in the Summary and in the full content editing area too, so it's definitely NOT an answer.
    – Sk8erPeter
    Commented Sep 13, 2013 at 8:08
0

Apply the patch at http://drupal.org/node/881006#comment-5628078. This makes sure the <!--break--> comment is not stripped out along with any other comments.

Aside(?): I'm using Display Suite and I found my teasers weren't working, even with this patch applied and the break comment in my HTML. I solved this by enabling a custom display for Teaser, and then choosing "Summary or trimmed" as the format at admin/structure/types/manage/page/display/teaser.

0

I know this is an old question but thought I'd share this anyway. I ran into the same problem but managed to solve it with a module called "Smart Trim"

I had a view display fields and I couldn't get the summary or trimmed values of my node body field to display, but with this module it gives me another display option which seems to work perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.