Mixing a Category & "Featured" Topics

Hi All,

I’d like to present topics from discourse in a blog-style, to replace a rather unloved blog.

I’ve already got an “Announcements” category in which only staff can create new topics.
I’d like to also have the option for staff to select topics from any category and market them (e.g. with a tag).

I’ve written a small Sinatra app which then collates the 10 latest Announcements and featured posts to show in a blog format.

Is it possible to restrict setting a tag (or tagging in general) to staff? Or is there another way to feature a topic without pinning it.

Here’s the code (using the discourse_api gem to help illustrate the idea

    announcements = API.category_latest_topics(category_slug: 'announcements').take 10
    features      = API.show_tag('food')["topic_list"]["topics"].take 10
    topics = (announcements + features).flatten
    topics.each { |t| t["created_at"] = Time.parse(t["created_at"]) }
    featured_topics = topics.sort { |a,b| a["created_at"] <=> b["created_at"] }.reverse.take 10

As a side note is there a way to just limit these API calls to returning the 10 most recent and paginating?
1 Like

Yes, have a look at staff_tags in site settings, those tags can only be applied by staff.

Also you can set min trust to create tag and min trust level to tag topics in site settings.