# Select metadata for Front Matter from two choices?

**URL:** <https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017>\
**Category:** Scrivener\
**Tags:** support, compile\
**Created:** [July 13, 2022, 11:37pm UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017 "2022-07-13T23:37:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmynsted](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/mmynsted/32/16128_2.png) [@mmynsted](https://forum.literatureandlatte.com/u/mmynsted)\
**Post date:** [July 13, 2022, 11:37pm UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/1 "2022-07-13T23:37:43Z")

</div>

I have a layout like:

 ![fm-layout](https://forum.literatureandlatte.com/uploads/default/original/3X/e/4/e423afed8c3a56120ac4da6ed262336a5cbc22de.png)

I have two collections. I one Metadata file is part of one collection, the other is part of the other collection.

I am compiling to a MultiMarkdown that is later converted to LaTeX by pandoc.

When I compile I want to be able to select a particular Metadata file, such as `Metadata Questions`, for the appropriate collection.

I can select it from the Front matter selection, make sure it is included, etc. If the _Metadata_ file in Front Matter is named `Metadata`, then it is included at the top of the _compiled_ markdown document, inside `---` bars. If the Front Matter _Metadata_ file is named anything else, then a metadata section is added to the head of the compiled document and the content of my selected _Metadata_ file is included after the closing `---`.

A. (Metadata file named `Metadata`.)

```nohighlight
---
 date: July 13, 2022
  revision: 3
  user-firstname: FirstName
  user-lastname: LastName
  author: FirstName LastName
  project-title: Test Project
---

```

B. (Named other than `Metadata`)

```nohighlight
  ---
  title: Test Project
  author: FirstName LastName
  ---

  date: July 13, 2022
  revision: 3
  user-firstname: FirstName
  user-lastname: LastName
  author: FirstName LastName
  project-title: Test Project

```

---

<div class="post-metadata">

**Author:** ![mmynsted](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/mmynsted/32/16128_2.png) [@mmynsted](https://forum.literatureandlatte.com/u/mmynsted)\
**Post date:** [July 14, 2022, 6:07pm UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/2 "2022-07-14T18:07:11Z")

</div>

I see now in the latest documentation in section `21.6 MMD & Pandoc Metadata` the following.

> 1. Compile group specific: if you place a document called “Metadata” at the very top of the selected documents you will be compiling, Scrivener will append the text in that file to the metadata block. In this way you can provide information specific to the compile group—for example if you are publishing multiple articles out of a single project, the “Title” metadata field would make a good candidate for this method. It is up to you to format the metadata rows properly as text. This file can be named “Metadata” or “Meta data” as well.

It seems that for a MMD / Pandoc compile the _metadata_ binder item **must** be named `Metadata` or `Meta data`. My idea of using different binder items for the metadata appears to be a dead end.

---

<div class="post-metadata">

**Author:** ![drmajorbob](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/drmajorbob/32/15777_2.png) [@drmajorbob](https://forum.literatureandlatte.com/u/drmajorbob)\
**Post date:** [July 14, 2022, 10:13pm UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/3 "2022-07-14T22:13:13Z")

</div>

Can’t you use two Metadata files (same name) and check their compile flags at compile time to activate the one you need and deactivate the other? Or include one of them in Collection A and the other in Collection B (and everything else in both)? I doubt using the same name for both is an issue, if you’re compiling only one.

---

<div class="post-metadata">

**Author:** ![mmynsted](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/mmynsted/32/16128_2.png) [@mmynsted](https://forum.literatureandlatte.com/u/mmynsted)\
**Post date:** [July 15, 2022, 3:31am UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/4 "2022-07-15T03:31:31Z")

</div>

Yes. That worked perfectly! 🙂

For some reason I did not think I could have two files with the same name in the same place in the binder.

Thank you.

---

<div class="post-metadata">

**Author:** ![drmajorbob](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/drmajorbob/32/15777_2.png) [@drmajorbob](https://forum.literatureandlatte.com/u/drmajorbob)\
**Post date:** [July 15, 2022, 3:45am UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/5 "2022-07-15T03:45:55Z")

</div>

You could also use two front matter folders and switch them at compile time, but the other two methods are probably easier.

---

<div class="post-metadata">

**Author:** ![AmberV](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/amberv/32/13021_2.png) [@AmberV](https://forum.literatureandlatte.com/u/AmberV)\
**Post date:** [July 15, 2022, 9:41am UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/6 "2022-07-15T09:41:18Z")

</div>

I use two different front matter folders, each with their own “Metadata” file in it at the top, and have it set up so that when I switch compile formats it selects the right front matter folder automatically. So the layout in the binder is like this:

```nohighlight
Front matter/
    Windows Front Matter/
        Metadata
    macOS Front Matter/
        Metadata

```

Now in the compiler, this is what one of the compile formats is set to:

![image](https://forum.literatureandlatte.com/uploads/default/original/3X/9/e/9e9efc95915f2bf7ea2e03ca144370fa58210b93.png)

The key thing is that lock button on the right. When locked, it causes this setting to be locked to the Format (which in this case is a Windows-specific output). I have the same setup for the Mac-specific output, but with the other folder selected.

---

<div class="post-metadata">

**Author:** ![drmajorbob](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/drmajorbob/32/15777_2.png) [@drmajorbob](https://forum.literatureandlatte.com/u/drmajorbob)\
**Post date:** [July 15, 2022, 4:32pm UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/7 "2022-07-15T16:32:08Z")

</div>

> [@AmberV](#):
>
> causes this setting to be locked to the Format (which in this case is a Windows-specific output)

As I understood the lock feature, it depended on the export file type – ebook vs. everything else – but what you’re describing has to depend on something else. How does that work? Is it locking each Format to a Front Matter choice? If so, why didn’t the same thing happen in the workflow I’m familiar with? Wait … is it locking in both ways at once?

---

<div class="post-metadata">

**Author:** ![AmberV](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/amberv/32/13021_2.png) [@AmberV](https://forum.literatureandlatte.com/u/AmberV)\
**Post date:** [July 15, 2022, 4:42pm UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/8 "2022-07-15T16:42:45Z")

</div>

Quite right, Formats remember their own front matter automatically, it’s file types that use the lock. It’s been +27° indoors for a good 3/4 of the day for the past five days at this point. My brain is soup. 😅

That aside, using the lock one way or another won’t make any difference if you’re just switching between two different Formats and don’t switch file types.

---

<div class="post-metadata">

**Author:** ![mmynsted](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/mmynsted/32/16128_2.png) [@mmynsted](https://forum.literatureandlatte.com/u/mmynsted)\
**Post date:** [July 15, 2022, 5:27pm UTC](https://forum.literatureandlatte.com/t/select-metadata-for-front-matter-from-two-choices/129017/9 "2022-07-15T17:27:18Z")

</div>

It is too bad I that `<$include:common>` does not work for the metadata. [As shown here](https://forum.literatureandlatte.com/t/replicants-the-ability-to-file-a-document-in-several-places/1255/30)

In any case two different Metadata files is a nice solution.
