-
Notifications
You must be signed in to change notification settings - Fork 274
Description
Currently, template triggers use OR logic - a template matches if any trigger condition is met. This creates issues when we want to combine multiple conditions (e.g., URL pattern AND schema type) to create more specific template matching.
Current Behavior (OR Logic)
{
"name": "IMDB Movies",
"triggers": ["schema:@Movie", "https://www.imdb.com/title/"]
}This template triggers if:
- Schema type is
MovieOR - URL starts with
https://www.imdb.com/title/
Problem Example
When creating separate templates for IMDB movies and TV series:
Movies Template:
{
"name": "IMDB Movies",
"triggers": ["schema:@Movie", "https://www.imdb.com/title/"],
"path": "02 • resources/movies"
}Series Template:
{
"name": "IMDB TV Series",
"triggers": ["schema:@TVSeries", "https://www.imdb.com/title/"],
"path": "02 • resources/series"
}Issue: Both IMDB movies and series pages use the same URL pattern (https://www.imdb.com/title/tt[numbers]/). If we want to add URL triggers for better specificity, we can't distinguish between them:
// This would match BOTH movies and series pages, (activated based on whichever template comes first...)
"triggers": ["...", "https://www.imdb.com/title/"]The only way to differentiate is through schema types, without a URL pattern; we can't combine URL + schema conditions.
Proposed Solution
Add support for AND logic within triggers, allowing multiple conditions to be required simultaneously.
I don't see a reason, why it was ever OR to begin with... reading through the code, it seems "simplicity reasons" could be the answer. However, I am curious, is there a valid case where someone might want to have an OR case for triggers.