mirror of
https://github.com/kepano/obsidian-skills.git
synced 2026-12-05 10:05:18 -08:00
Merge pull request #84 from hst368/fix-properties-prefix-and-prereqs
# Conflicts: # skills/obsidian-cli/SKILL.md
This commit is contained in:
@@ -5,6 +5,10 @@ description: Create and edit Obsidian Bases (.base files) with views, filters, f
|
|||||||
|
|
||||||
# Obsidian Bases Skill
|
# Obsidian Bases Skill
|
||||||
|
|
||||||
|
## Prerequisite
|
||||||
|
|
||||||
|
Bases is a **core plugin** introduced in Obsidian v1.9, but it is **not always enabled by default** — particularly in vaults that predate v1.9. If `.base` files do not render as a database, enable Bases via Settings → Core plugins → Bases.
|
||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
1. **Create the file**: Create a `.base` file in the vault with valid YAML content
|
1. **Create the file**: Create a `.base` file in the vault with valid YAML content
|
||||||
@@ -32,13 +36,15 @@ filters:
|
|||||||
formulas:
|
formulas:
|
||||||
formula_name: 'expression'
|
formula_name: 'expression'
|
||||||
|
|
||||||
# Configure display names and settings for properties
|
# Configure display names and settings for properties.
|
||||||
|
# IMPORTANT: keys in this section must use their fully-qualified form.
|
||||||
|
# Frontmatter properties need the `note.` prefix or the displayName is silently ignored.
|
||||||
properties:
|
properties:
|
||||||
property_name:
|
note.property_name: # frontmatter property — MUST prefix with `note.`
|
||||||
displayName: "Display Name"
|
displayName: "Display Name"
|
||||||
formula.formula_name:
|
formula.formula_name: # formula reference — already prefixed
|
||||||
displayName: "Formula Display Name"
|
displayName: "Formula Display Name"
|
||||||
file.ext:
|
file.ext: # file property — already prefixed
|
||||||
displayName: "Extension"
|
displayName: "Extension"
|
||||||
|
|
||||||
# Define custom summary formulas
|
# Define custom summary formulas
|
||||||
@@ -128,6 +134,8 @@ filters:
|
|||||||
2. **File properties** - File metadata: `file.name`, `file.mtime`, etc.
|
2. **File properties** - File metadata: `file.name`, `file.mtime`, etc.
|
||||||
3. **Formula properties** - Computed values: `formula.my_formula`
|
3. **Formula properties** - Computed values: `formula.my_formula`
|
||||||
|
|
||||||
|
**Asymmetric prefix rule**: in `order`, `filters`, `groupBy`, and `sort`, a frontmatter property can be referenced bare (`author`) or prefixed (`note.author`). But in the top-level `properties:` configuration block (where `displayName` is set), frontmatter keys **must** use the `note.` prefix — bare keys are silently ignored and the raw field name will appear as the column header. See Troubleshooting for the symptom.
|
||||||
|
|
||||||
### File Properties Reference
|
### File Properties Reference
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
@@ -336,7 +344,7 @@ formulas:
|
|||||||
priority_label: 'if(priority == 1, "🔴 High", if(priority == 2, "🟡 Medium", "🟢 Low"))'
|
priority_label: 'if(priority == 1, "🔴 High", if(priority == 2, "🟡 Medium", "🟢 Low"))'
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
status:
|
note.status:
|
||||||
displayName: Status
|
displayName: Status
|
||||||
formula.days_until_due:
|
formula.days_until_due:
|
||||||
displayName: "Days Until Due"
|
displayName: "Days Until Due"
|
||||||
@@ -390,10 +398,10 @@ formulas:
|
|||||||
year_read: 'if(finished_date, date(finished_date).year, "")'
|
year_read: 'if(finished_date, date(finished_date).year, "")'
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
author:
|
note.author:
|
||||||
displayName: Author
|
displayName: Author
|
||||||
formula.status_icon:
|
formula.status_icon:
|
||||||
displayName: ""
|
displayName: "Status"
|
||||||
formula.reading_time:
|
formula.reading_time:
|
||||||
displayName: "Est. Time"
|
displayName: "Est. Time"
|
||||||
|
|
||||||
@@ -537,6 +545,24 @@ formulas:
|
|||||||
'if(due_date, (date(due_date) - today()).days, "")'
|
'if(due_date, (date(due_date) - today()).days, "")'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**`displayName` ignored / column shows raw field name**: in the `properties:` configuration block, frontmatter keys must be prefixed with `note.`. Bare keys are silently ignored.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# WRONG - displayName ignored, column header shows "status"
|
||||||
|
properties:
|
||||||
|
status:
|
||||||
|
displayName: Status
|
||||||
|
|
||||||
|
# CORRECT - column header shows "Status"
|
||||||
|
properties:
|
||||||
|
note.status:
|
||||||
|
displayName: Status
|
||||||
|
```
|
||||||
|
|
||||||
|
This asymmetry trips users up because `order`, `filters`, and `groupBy` all accept the bare form. The `properties:` block is the exception.
|
||||||
|
|
||||||
|
**Empty `displayName` does not hide a table header**: `displayName: ""` falls back to the property name, just like omitting `displayName`. For example, `formula.status_icon` displays `status_icon`. Use a non-empty name such as `displayName: "Status"` to customize the header.
|
||||||
|
|
||||||
**Referencing undefined formulas**: Ensure every `formula.X` in `order` or `properties` has a matching entry in `formulas`.
|
**Referencing undefined formulas**: Ensure every `formula.X` in `order` or `properties` has a matching entry in `formulas`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user