Can I suggest that footnotes are not displayed in teasers - or perhaps give webmasters the option of being excluded. They are, in my view unnecessary to get a flavour of the full node and make the teaser look untidy.

Thanks

Comments

hingo’s picture

Status: Active » Closed (won't fix)

Hi

This has been suggested and discussed before. While I kinda understand the proponents, last discussion ended by them failing to convince me :-) (See http://drupal.org/node/87226#comment-453455)

Note that the Drupal filter architecture is such, that Footnotes doesn't know whether it is working on a teaser or a full article. That's why there is no clean way to do what you want. If there was, I sure would have done it.

To get what you want, you could use Excerpt module: http://drupal.org/project/Excerpt and In Drupal 6.0 you have the same functionality built in. This will annoy you a little bit, because you need to copy-paste the teaser text into a separate box, but you get the result you want.

It would also be possible to use CSS to not show any footnotes in the teasers (even if they were generated by Footnotes), but unfortunately the themes that are available don't seem to provide any class attributes to make such a trick possible. In effect, you'd have to hack your Drupal theme code to output a new div for identifying the frontpage, then use .teasers .footnotes {display: none;} to hide footnotes from teasers. This is a relatively clean solution, apart from the need to modify your theme php code. (I can elaborate on this solution if you want, but for now I'll stop here.)

I'll close this, because it will not be implemented. But feel free to continue discussing the issue if you want.

david@thrale.com’s picture

Thanks for the reply. In most nodes I can put the fn after the <--break!> which works. However a handful need this after a few words. Thanks for a great module anyway!

physiotek’s picture

here's what i did:

1. modified the module to add a div:

if( $op == 'output footer' ) {
    if( $n > 0 ) {
      $str = '<div class="footnotes_div">';
      $str .= '<ol class="footnotes">';
      for( $m = 1; $m <= $n; $m++ ){
        $text = $store_matches[ $m - 1 ][0];
        $randstr = $store_matches[ $m - 1 ][1];
        $str .= '<li><a class="footnote" name="footnote' . $m . '_' . $randstr .
                '" href="#footnoteref' . $m . '_' . $randstr . '">' . $m . '.</a> ';
        $str .= $text . "</li>\n";
      }
      $str .= "</ol>\n";
      $str .= "</div>";
    }
    $n = 0;
    $store_matches = array();
    return $str;
  }

2.created a new theme file:
footnotes_div.css

div.footnotes_div{display: none;}

3.called the new file from node.tpl.php only if a teaser:

<?php if ($teaser):  ?>
<style type="text/css" media="all">@import "<?php print base_path() . path_to_theme() ?>/footnotes_div.css";</style>
<?php endif; ?>

4.enjoy!
of course it'S only hidden; the processing load/time is still there... but it works!

hingo’s picture

pht3k:

Why add a div? Why not just have

ol.footnotes{display: none;}

...directly? Other than that, quite clever. Considering that the filter api doesn't give any info on whether you are in a teaser or not, this is probably the cleanest way there is to do it. (But since you modify node.tpl.php, it couldn't be included in the module itself, just to be clear.)

Btw, I'm a bit surprised to find out this is still an issue. Apparently there are many of you that would really prefer the footnote to go away automatically, rather than use the option of writing a separate teaser, which is easy in Drupal 6.

physiotek’s picture

pht3k:

Why add a div? Why not just have

ol.footnotes{display: none;}

maybe because i am not a php nor a css guru hehe ;)

btw i am still on D5 and yes i do prefer to dont have to care about writing a separate teaser.

defconjuan’s picture

Yeah, I did something similar. On my theme's node.tpl.php page, I added the following code:

  <?php if ($teaser): ?>
  <style type="text/css">ol.footnotes{display: none;}</style>
  <?php endif; ?>
asb’s picture

Version: 5.x-1.3 » 6.x-2.x-dev
Component: Footnotes.module » Footnotes

Thanks for the theme hack from #6 - it works beautifully on D6/Pressflow 6.16.

...but I'd really love to have this as default behaviour in a future version of the 'Footnotes' module.

hingo’s picture

asb: The change in #6 needs to be done in your theme, it cannot be done in Footnotes.

What you really want to do is not the above footnotes specific change, but just something like:

  <?php if ($teaser): ?>
  <div class="teaser">
  <?php endif; ?>
  ...template goes here...
  <?php if ($teaser): ?>
  </div>
  <?php endif; ?>

Of course, in your template there probably already is a div, where you should just add the "teaser" class.

asb’s picture

@hingo:

I did not mean exactly this theme hack from #6 but the general behaviour that footnotes don't show up in teasers at all, under no circumstances, never ever ;) (that's what this issue initially was about). And yes, I've read that you couldn't be convinced in earlier discussions (#1; "won't fix" status of this issue). So I'm simply happy that there's a working and simple hack.

I'm not sure what would be wrong with the hack from #6 - it does what it's supposed to do...?

Greeting, -asb

versdoc’s picture

Another way to hide through css if you list node teasers throug the views module.
On you view config page add CSS class in Basic settings section. Smth like "footnotes-hide". Thereafter add to style.css of your template this class .footnotes-hide ol.footnotes {display: none;}.

Thats all and no php :)

mtrahan’s picture

I just installed Footnotes (3 years after previous post) and I was wondering what would be the easiest way to achieve this result today? The module comes with "Footnotes with Views" and description says precisely that it: "Add views support to the footnotes module by allowing you to cut the footnotes from the rest of the body (or teaser)." I can't seem to get this working. And have yet to find documentation about it. Any help appreciated. Thanks!

Jonathan_W’s picture

Issue summary: View changes

To fix this issue, I simply added the following to my style.css file:

.block-views .see-footnote, .block-views .footnotes,
.node-teaser .see-footnote, .node-teaser .footnotes { display:none; }

That removes the footnotes from both teasers and blocks.

stevep’s picture

In Drupal 7 another solution (which requires more diligence when updating node text), is to edit the summary, copying all that is desired to show in the teaser, from the node body including all [fn] .. [/fn] inserts, and placing [footnotes] at the bottom of the teaser, so that a footnotes section is seen, but is restricted only to footnotes in the teaser.

The full node defaults to normal behavior (taking note to delete "<"!--break--">" if any were previously set), so that in either teaser or full node, a footnotes section is seen and each includes all links and footnotes pertaining to that view.

Actually updates aren't a problem -- I simply edit the full node text, then copy all the text needed for the teaser including all the [fn] .. [/fn] inserts, and paste directly over what was in the summary section previously, above the [footnotes].