diff --git a/Definition-format.md b/Definition-format.md index ce0b4fc..92123e8 100644 --- a/Definition-format.md +++ b/Definition-format.md @@ -636,6 +636,27 @@ In the event that you need to provide a default category due to the possibility selector: a.label[href*="type="] ``` +#### Providing other fields with a default value + +In the event that a field (other than category) might not be reliably present from the site results, you can use the `default` statement, as shown in these examples: + +```yaml + title_default: + # this title may be abbreviated + selector: a[href^="details.php?id="] + title: + # this title if present is full length + selector: a[title][href^="details.php?id="] + attribute: title + optional: true + default: "{{ .Result.title_default }}" + seeders: + # seeders may be missing + selector: a[href$="toseeders=1"] + optional: true + default: 0 +``` + ### Search JSON Example of a complex search block explaining all available options: