Plone 4: Tweaking the All Content View

The biggest benefit to me of the collective.blogging product (which does not appear to work in Plone 4) was that I could display a full blog post or page in a collection (a.k.a. topic). In other words, Plone could look like any other blog! That is now built in to Plone 4, with the all content view under your display menu. Now the challenge is how to tweak it to look like what I had in Plone 3.

I relied on a customized folder_summary_view to fiddle with the pseudo blog look.  The All Content (a.k.a folder_full_view and folder_full_view_item) returns to a stripped down look: title, byline, description, content, and belowcontent document actions.

One of the things that I think makes it look more blog-ish is to include your tags or categories.  I initially tried to include them by duplicating one of the other lines and trying to display:

structure: provider plone.belowcontenttitle.keywords

First, I still can’t figure out why belowcontenttitle does not actually appear below the content title but, instead, appears at the bottom of the document.  Secondly, this doesn’t work even though the same line without keywords does invoke the byline.

I reverted to my old folder_summary_view tweaking and that seems to work.  That code, for lack of better term, grabs all of the attached categories (a.k.a. tags, a.k.a. subjects) and returns them wherever you place the code.  Each category is plugged into a link that will invoke your search tool, to automatically return all related content with the same category.

The first thing you have to do is to define your categories.  Anywhere within the <div … tal:define=” area, on its own line, you want to add

item_subject context/Subject|nothing;

this is a change from Plone 3, where the line was

item_subject item/Subject|nothing;

That will grab the related categories.  This will display them – just paste it into your template wherever you want them to go.  I’m using the default CSS so I am sure you can re-style them to make them look nicer:

<div id=”category” class=”documentByLine”>
Filed under:&nbsp;
<span tal:repeat=”relatedtop item_subject“>
<a href=”#”
class=”link-category”
tal:attributes=”href python: ‘/search?Subject=’ + relatedtop“>
<span tal:replace=”relatedtop“>Subject</span>
</a>&nbsp;
</span>
</div>

It’s pretty straight forward.  The line you put in the define section has to match the item_subject here.  You can call it whatever you want.  Same thing with relatedtop, which I have because they were . . . related topics!  Nothing fancy here!

I will probably move them up into the byline are but I will need to re-style them first to make them less obtrusive.