Skip to content

Status gating for heroes #629

Description

@patinen

Enhancement Description

  • What is it?: Add a status field to the heroes collection in Directus (Published / Draft / Archived) and update heroApi to only fetch Published heroes by default (Draft/Archived should not be publicly visible).
  • Why improve it?: We currently have empty or unfinished hero pages in production because heroes are being created as placeholders (slug/name only) while descriptions, images and other required fields are still missing. Status gating prevents unfinished content from appearing on the live site.

🌟 Benefits of the Enhancement

  • User Experience: No more blank or incomplete hero pages in production. Users only see fully prepared (Published) heroes.
  • Project Impact: Establishes a clear and structured content workflow: create heroes as Draft, complete all required fields, then publish when ready. Reduces confusion and ensures no unfinished sections are exposed on the public site.

🛠️ Proposed Implementation

  • Technical Details:

    • Directus
      • Add heroes.status as a Select/Dropdown field (example in the news data model, attached screenshot)
      • Options: Published, Draft, Archived
      • Default: Draft
      • Use a “Status” UI similar to the provided screenshot for clarity
    • Frontend (heroApi)
      • Include status in FIELDS (for consistency and debugging)
      • Add a filter to all public hero queries so they return only status == "Published" by default:
        • filter[status][_eq]=Published
      • Ensure this applies to:
        • getHeroBySlug
        • getAllHeroes
        • getHeroGroups
        • fetchHeroBySlug
        • fetchAllHeroes
  • Implementation Plan:

    1. Directus schema
      • Create status field on heroes
      • Set default to Draft
      • Configure allowed values: Published / Draft / Archived
    2. API query updates
      • Update buildParams() to always append filter[status][_eq]=Published
      • Add status to FIELDS
    3. Validation
      • Verify existing placeholder heroes remain hidden until marked Published
      • Confirm getHeroGroups grouping works correctly with filtered results
      • Ensure getHeroBySlug returns undefined for Draft/Archived heroes (so the UI can render 404/NotFound appropriately)

📎 Additional Information

  • Mockups/Examples: Directus Status dropdown UI should match the attached screenshot: default Draft, editors switch to Published only when content is complete.
  • Notes:
    • This enhancement enforces a clean separation between work-in-progress content and publicly visible content.
Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementFor improvements to existing featuresmediumlevel_medium

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions