Skip to content

[Bug] Genre not detected from structure.md — published as Uncategorized #169

@realproject7

Description

@realproject7

Problem

When publishing a genesis, the genre is extracted from structure.md via regex:

```typescript
let genre = "Fiction"; // default
const genreMatch = structData.content.match(/genre[:\s]+(.+)/i);
if (genreMatch) genre = genreMatch[1].trim().slice(0, 30);
```

This only matches if structure.md has an explicit line like `Genre: Romance`. But AI-generated structure.md files don't always have that format — the genre info is embedded in the narrative text.

Result: Genre defaults to `"Fiction"` which isn't in plotlink.xyz's allowed genre list → stored as "Uncategorized".

Root Cause

`app/web/components/StoriesPage.tsx` line 195-201.

Fix Options

Option A (recommended): Look for genre in multiple formats:

  • `Genre: Romance`
  • `Genre: Romance`
  • `## Genre` section header followed by text
  • `genre: romance` in YAML-style frontmatter

Option B: Add a genre selector dropdown in the publish UI. Let the user pick before publishing instead of auto-detecting.

Option C: Ask the AI terminal to always output a standardized `genre:` line in structure.md.

Option B is most reliable — auto-detection will always have edge cases.

Allowed genres on plotlink.xyz

Check what genres the StoryFactory contract or plotlink.xyz accepts and ensure the detected genre matches one of them.

Files

  • `app/web/components/StoriesPage.tsx` — genre detection logic (line 195-201)

Acceptance Criteria

  • Genre correctly detected or user-selected before publish
  • Published stories have correct genre (not "Uncategorized")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions