estruyf / vscode-front-matter

Front Matter is a CMS running straight in Visual Studio Code. Can be used with static site generators like Hugo, Jekyll, Hexo, NextJs, Gatsby, and many more...
https://frontmatter.codes
MIT License
1.86k stars 70 forks source link

Issue: Variable interpolation is not working in array/list for placeholder #752

Closed Mikescops closed 4 months ago

Mikescops commented 5 months ago

Describe the bug When using a default placeholder that is an array, the variables are not interpolated inside.

To Reproduce Create a new field in your contenttype with the following:

               {
                    "title": "aliases",
                    "name": "aliases",
                    "type": "list",
                    "default": [
                        "post/{{slug}}"
                    ],
                    "hidden": true
                }

You should get the following:

---
title: test-title
slug: test-title
aliases:
  - post/{{slug}}
---

Expected behavior The slug variable should be rendered properly.

---
title: test-title
slug: test-title
aliases:
  - post/test-title
---

Note that using "default": "post/{{slug}}" properly renders "default": "post/test-title" so the problem is related to how array are managed.

estruyf commented 5 months ago

Thanks, @Mikescops; this is indeed not yet supported, but let us make it happen! 💪

estruyf commented 5 months ago

@Mikescops was added and is testable in the latest beta version.

Mikescops commented 5 months ago

@Mikescops was added and is testable in the latest beta version.

sounds like it broke the normal string interpolation 😓

image image
estruyf commented 5 months ago

That is correct 🤦‍♂️, should be better with the new fix

Mikescops commented 5 months ago

Much better, thanks!

image