Embedding Bases in Template files

What I’m trying to do

Hi, I have just bought into Catalyst specifically for Bases and am loving it!

I am using Obsidian for archival work where I’m going through old books and periodicals and noting down all the different texts and recording their titles, authors, topics, etc.

I have a folder called Authors with a file for each author and some YAML data that describes useful information about them and space for biographical notes, secondary literature on them, etc. These files all have a property called ‘type’ with the value ‘author’. So e.g. for the author John Smith, there is a file titled “John Smith” with:

---
type: author
denomination: protestant
birthdeath: 1900–1950
---

I have another folder called Texts with a file for each article/book that includes YAML properties for author, year of publication, etc. At the moment, to link texts to their authors, I am just putting [[–]] around the author name so that property links directly to the file with that author’s name as its title.

---
type: text
author: [[John Smith]]
pubyear: 1925
source: Truth Magazine
---

I want to make a template for creating author files which automatically embeds a base on the author page that displays all the texts by that author. e.g. when I create a new author file from the template and title it “John Smith”, it will automatically include a base that shows all the folders in the Texts folder who have John Smith as their author.

---
type: author
denomination: 
birthdeath: 
---

# Bio

# Secondary Sources

# Texts

{???bases code???} 

My question is basically what do I put where I’ve got {???bases code???} to generate a base that will show all files in the Texts folder where the “author” property has a value that matches the file name? There is probably a simple answer but reading the documentation I can’t quite figure it out.

Thanks!!!

Hello.

I would use something like:

---
file: John Smith
type: author
denomination: protestant
birthdeath: 1900–1950
---

# Bio

# Secondary Sources

# Texts

![[authors.base]]

Note the quotes needed below for the link in Properties

---
file: Truth Magazine
type: text
author: "[[John Smith]]"
pubyear: 1925
source: Truth Magazine
---

With a separate authors.base (or whatever name you choose).

views:
  - type: table
    name: Table
    filters:
      and:
        - file.hasLink(this.file.name)
    order:
      - author
      - file.name

The Base is then embedded with ![[authors.base]]

If the Base has multiple views, you can embed it with the specific view ![[authors.base#MyView]]. See: Embed a Base File

2 Likes

Agreeing with what Guapa said about embedding the base instead of writing a base code block in every author note.

Their suggestion will show every note in the vault that links to the author note. If you still want to just “show all files in the Texts folder where the ‘author’ property has a value that matches the file name”, then …

If author is a text property with only one author link per text note, like in your example, then you could use:

filters:
  and:
    - file.folder == "Texts"
    - author == this

But if you want to turn author into a list so you can have multiple authors per text note, then swap out the above “author == this” with this filter instead:

author.contains(this)
4 Likes