Listing unique keywords

I generate a listing for 'keyword'.
(so the user clicks on the keyword and is shown all items with that keyword):

For this, I use:


But… this also returns keywords for items that are not published.

What is the best way around this?

Going through the list of returned values and check that it returns more than 0 objects ?

1 Like

Create your own keyword indexes "Subject_published" with a custom index that indexes "Subject" but only for published content.

1 Like

Is that true even when you're testing this as an anonymous user?

1 Like


uniqueValues() is a ZCatalog functionality which does not know anything about what "published" means on the Plone level.

1 Like