Hi,
on my site, I don't use teasers, not even body fields, so I do not want to display anything related to 'trimmed version' on preview pages. Is there any way to do this in D7 without some dirty hacks to hide the related html and message on the preview pages?

CommentFileSizeAuthor
#18 Screenshot-20151107-150509.png50.38 KBSeanA
#7 trim.gif13.91 KBdjmy

Comments

wouter99999’s picture

I solved this by using theme_node_preview

wouter99999’s picture

Status: Active » Fixed
winawer’s picture

Version: 7.0-rc2 » 6.x-dev

no need to use "theme_node_preview".
just go to "Post settings" in address: "admin/content/node-settings" and set "Length of trimmed posts:" to "Unlimited".
by this setting "trimmed version" in preview will gone.

wouter99999’s picture

Winawer are you sure? I don't have a node-settings page, only an admin/content page.. I also checked the administration menu and it is not there (using Drupal 7-rc2)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

greatmatter’s picture

It's been moved...
Go to:
http://YOURSITE.com/admin/structure/types/manage/page/display/teaser

or, if you want to do it the hard way,

  1. Administration
  2. Structure
  3. Content Types
  4. Manage Display (on any of the content types for which you want to change the default length)
  5. Teaser (it's a tab)
  6. Click the gear on the right-hand side
  7. Change the length
  8. Click save
djmy’s picture

Version: 6.x-dev » 7.8
Status: Closed (fixed) » Active
StatusFileSize
new13.91 KB

i entered "unlimited" and i get this: "Trim length must be a positive integer." This is on the latest drupal 7 version. Anyone have the same issue?

herojig’s picture

Same here. Frustrating eh?

Mark4’s picture

Version: 7.8 » 6.22

In version 6.22 go to Administer > Content Management > Post Settings

Set 'Length of trimmed posts' to 'Unlimited'. Then open and save the content you want this to apply to (as these changes only apply to new / updated posts).

mototribe’s picture

any ideas on how to fix that in D7 (other than using css)?

chrsnlsn’s picture

Version: 7.x-dev » 6.22

I posted a solution using the theme_node_preview here
http://drupal.org/node/1355962#comment-5711632

[edit for 7]

chrisla’s picture

Version: 6.22 » 7.x-dev

I think this was originally an issue for D7, not D6.

Is there an equivalent setting for D7 to set the length of trimmed posts to unlimited, as could be done through D6?

sgwood’s picture

to set the teaser to unlimited go to the teaser version of the page i.e.
YOUR_SITE/admin/structure/types/manage/page/display/teaser
then change the FORMAT dropdown from "Trimmed" to "Default"

to then remove the Read More you will need to not display
it in your CSS like this:

/* remove read more */
li.node-readmore a {
display:none;
}

cheese_monkey’s picture

There are two different questions here.

"Teasers" can be disabled in D7 in admin/structure/types/manage/whatever_content_type/display under the "Custom display settings" section.

Unfortunately, even after doing that, previews still show a "trimmed version". There are no controls for its length, nor for teaser length once teasers have been disabled, and D7 only accepts positive integers for lengths.

D7 decides whether to show the trimmed version based only on whether the default HTML matches the teaser HTML, even if you're not showing the teaser. Sigh. You'd think that changing the teaser format to "Default" to match the main format would produce identical HTML, but it still concludes they're different. It doesn't actually matter what the teaser length is set to (I tried 60,000), it still generated "different" HTML when both Default and Teaser were set to default format.

There doesn't seem to be a way to do this in D7 without using a custom theme or custom CSS. :-(

simon147’s picture

Version: 6.22 » 7.20

Sumbitted this as a bug.

pasqualle’s picture

Status: Active » Fixed

What @cheese_monkey said is true, and the problem can be considered a bug in D7, but this problem can be fixed without core changes:

2 possible options explained:
http://drupal.stackexchange.com/questions/7043/override-theme-node-previ...

contrib module (same as the second option on stackexchange):
https://drupal.org/project/no_trimmed_preview

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

SeanA’s picture

Version: 7.20 » 7.x-dev
Category: Support request » Feature request
Issue summary: View changes
Status: Closed (fixed) » Active
StatusFileSize
new50.38 KB

This is still a problem. (Why mark this issue as fixed and simultaneously state that it can be considered a bug?) "No trimmed version on preview" seems like a fairly commonly request and it makes sense to put this in core.

The suggested fix (contrib module, which is the same as the 2nd post on Drupal Answers/Stack Exchange) is all-or-nothing: it disables the trimmed version on preview on all node types. And the discussion on Stack Exchange says that this is an evil, hacky solution.

There should be a "Disable trimmed version on preview" checkbox on the edit form for each content type.

rickj’s picture

I've also just been wrestling with this and come up with a solution that doesn't require messing with themes, but just needs a tiny patch to a core file. In core modules/node/node.pages.inc, make the following change:

function theme_node_preview($variables) {
  $node = $variables['node'];

  $output = '<div class="preview">';

  $preview_trimmed_version = FALSE;

  $elements = node_view(clone $node, 'teaser');
+  $istrimmed = isset($elements['body']);	// true if there is actually preview text
  $trimmed = drupal_render($elements);
  $elements = node_view($node, 'full');
  $full = drupal_render($elements);
  // Do we need to preview trimmed version of post as well as full version?
-  if ($trimmed != $full) {
+  if ($istrimmed && $trimmed != $full) {
    drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication.<span class="no-js"> You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.</span>'));
    $output .= '<h3>' . t('Preview trimmed version') . '</h3>';
    $output .= $trimmed;
    $output .= '<h3>' . t('Preview full version') . '</h3>';
    $output .= $full;
  }

Now you can suppress the trimmed preview per-content-type simply by hiding the body field in the teaser view. This assumes that you only don't want to see teaser previews if you don't display them. On content types where I use teasers I like to see the teaser preview so I can tweak the break if needed.

If I understand #14 correctly, this is the solution to that problem (the reason the full-length-teaser and body texts are different is probably the "Read more" at the end of the teaser!).

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.