*Question: How do I configure Metadata Menu for MultiFile selection using aliases and additional metadata?

I am using Obsidian 1.7.7 with Metadata Menu 0.8.7 and Dataview 0.5.67. I am trying to configure a YAML field called area (with the MultiFile field type) in Metadata Menu, so I can select files in the modal based on specific criteria and display an alias.

Goal

  1. Criteria for files in the modal:

• Only files located in the “02 areas/” folder (and subfolders) should be displayed.

• Files must have a YAML field arealevel that is not empty.

This filtering is already working using the following DataviewJS query:

dv.pages('"02 areas"')
.where(p => p.arealevel != null);
  1. Alias display in the modal:

• If a file has an alias (defined in the YAML field aliases), I want to display the alias.
• If no alias is present, the file name should be displayed instead.

I tried configuring this with the following Alias function in Metadata Menu:

function(page) {
return page.aliases?.[0] || page.file.name; // Use alias if available, otherwise the file name
}

However, this does not work as expected. The modal does not consistently display the alias, and the functionality seems limited.

  1. Future expansions (optional):
    • Eventually, I would like to append the arealevel value to the alias, like this:
  • Alias (Arealevel: 2)
    But for now, getting the alias to work correctly is my priority.

Problem

While the filtering of files via the DataviewJS query works, I cannot get the alias to display correctly in the modal using the Alias field in Metadata Menu. It seems that the aliases fields from YAML are not always retrieved or processed as expected.

Questions

• How can I configure the Alias function so that the modal displays the alias (if present) or the file name (if no alias is defined)?
• Are there limitations in Metadata Menu or DataviewJS that could affect how aliases is retrieved and used?
• How can I ensure the modal displays the alias and, optionally, additional metadata (like arealevel) correctly?

Example YAML
Here is an example of how my YAML fields are structured:

aliases:
- Project Alpha
arealevel: 2

Thank you!

I hope someone can help me set up Metadata Menu for this use case.

Bas