How do I create a node teaser in a mini panel

Events happening in the community are now at Drupal community events on www.drupal.org.
macuhail's picture

I am new to panels so this may be a very obvious and easily answered question. But I have not been able to find any related info.

We have a community newspaper where any registered user can contribute stories. We created a mini panel to go into a block that will hold a "top story". The top story will be hand selected via the mini panel context.

We can get this action to work, but the block shows the entire story. We want the block/mini panel to show a "teaser" of a part of the story then a "read more" link at the bottom that will take the user to the full story.

How do we get the desired teaser/read more behavior for this panel?

Thanks for any suggestions.

Comments

Simple answer & a more involved approach

laken's picture

Simple answer

While I haven't actually tried exactly what you're doing, I believe you just need to check the "teaser" checkbox in the pane configuration dialog:

Only local images are allowed.Only local images are allowed.

More deluxe solution

Since I'm here, I'll take the opportunity to explain how I approach the same need on a site I'm currently building. This solution is a little (well, maybe a lot) more complex, but I think it may give you more flexibility in the long run, especially for a newspaper site.

Required modules

Recipe

  1. Set up a node queue
    If you're not familiar with Nodequeue, it lets you create arbitrary lists of nodes. It's perfect for newspaper-type sites where editors are hand-selecting featured articles from a body of existing content. You can create as many node queues as you need, and define how many nodes each queue can hold. In this case, you would create a node queue with length 1 (i.e. only 1 node can be the Top Story), and also define which content types can be in the queue - here you would allow whatever your story content type is to be in the queue.
    Only local images are allowed.

    Finally, grant the permissions for the editor role to be able to manipulate the queue (add/remove nodes from it).

  2. Add an article to the Top Story node queue

    One advantage here is that you can promote any article to be the Top Story just by viewing the node: if you have proper permissions, on the node page you'll see a link at the bottom that will put this story into the Top Story queue:

    Only local images are allowed.

    Just clicking that link pushes this post into the Top Story node queue - editors don't need to note the node ID of the desired article and then dig into the panel context configuration every time they want to change the Top Story, which can be error-prone. Also from a security standpoint, you don't necessarily want to let all your editors mess with your panel configurations.

    When it's time to make another story the Top Story, just go to that story's page and click that link.

  3. Make a view for the Top Story
    To actually use the node queue you need to make a view to display it. Fortunately Nodequeue module includes views support (it should, it was written my merlinofchaos, who also wrote Views as well as most of Panels.) If you go to /admin/build/views and look in the "Default Views" section, you should see an entry for the node queue you've made, which looks something like this (except yours probably says nodequeue_1 and nodequeue/1):

    Only local images are allowed.

    Click "Add" to create an overridden view for this queue. By default, this view provides Page and Block views (you may want to uncheck "Provide Page View" if you know you'll only use it as a block.) Under "Block" options, make sure to change View Type to "Teaser List". Save the view.

  4. Add your new block to your mini-panel
    Go edit your mini-panel, find the block generated from the view you just made, and add it to the mini-panel. The block of the teaser should now appear:

    Only local images are allowed.

  5. That should be it. For the price of a bit more setup time, you now have a much improved editorial workflow to add top stories without having to worry about editors accidentally messing up your panel configurations.

    Nodequeue can do much more than just manage a block of a single Top Story. Suppose you want a block to display links to 5-10 editor-designated featured stories? Easy - just repeat the steps above to make a new node queue, but this time the queue should have no arbitrary length (enter 0 in the queue length.) Make a new view but instead of "Teaser List" the view type should remain as "List View". Add the block to your layout and you have a Featured Stories block. Once you have stories in the queue they can be easily re-ordered through the admin interface at /admin/content/nodequeue/[queue #]/view :

    Only local images are allowed.

    To get a better sense of how nodequeue works and how it can help a newspaper-type site, see merlinofchaos' demo site here: http://nodequeue.demo.logrus.com/ - login with username: demo password: demo to see how the site is put together - it automatically resets every 30 minutes so you can't screw anything up.

    Hope this helps!

Thanks for the great info.

macuhail's picture

Thanks for the great info. Checking the teaser option did the trick. Also we are definitely going to explore the nodeque option you outlined. That will be a big help with workflow.

Great explanations also!

Great explanation!

cpelham's picture

Your explanation of the nodequeue workflow is really clear and helpful.

When the Drupal re-design happens, i hope that the great info like this on groups.drupal.org and in the issue queues can get swept into the Drupal documentation (or will at least come up when using Drupal search).


Christopher Pelham
Director
CRS (Center for Remembering & Sharing)
http://www.crsny.org

CRS (Center for Remembering & Sharing) is an arts & healing center located just south of Union Square in Manhattan.

Panels

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: