fff-covers FanFicFare + Calibre cover guide

Precise tag matching

Avoid accidental matches from short or ambiguous keyphrases

The basic Genres and flags recipe looks for a chosen phrase anywhere in the saved tags. That can give false matches: a rule for the complete tag AU might also pick up the letters au inside Haunted House. This technique makes the rule match a whole tag instead.

What the precise example does

Calibre’s str_in_list() checks each item in a comma-separated list separately. This lets you ask for the complete tag AU, rather than the letters au anywhere inside another tag.

This example assumes that the genre template already reads your Tags column into a value named tags. Add the block after the template’s result = ''; line, alongside its other genre checks:

result = list_join(', ', result, ',', test(
    str_in_list(tags, ',', 'au', '1', ''),
    'AU', ''
), ',');

The parts mean:

For example, source tags of Fluff, AU, Time Travel produce AU. Source tags of Fluff, Alternate Universe AU produce nothing from this rule, because none of those complete tags is exactly AU. Save the calculated column and check both kinds of book before regenerating a cover.

Put this code in the Template box of the calculated column that produces the value, such as #genre. It does not go in personal.ini or Generate Cover. You can add a separate rule for a longer tag such as Alternate Universe AU, or keep a broader match when several related tags should produce the same label.

Limitations

Exact matching avoids false positives but misses spelling variants and longer AO3 tags unless you add each one. It also relies on commas separating the source values. Use it for short ambiguous terms, not automatically for every genre keyphrase.