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...

Home Page:https://frontmatter.codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue: Content folder does not exists, remove it from the configuration does not work with folder setup

davidsneighbour opened this issue · comments

I have a folder that ceased to exist, configured in .frontmatter/config/content/pagefolders/components.json.

{
  "$schema": "https://frontmatter.codes/config/content.pagefolders.schema.json",
  "title": "Components",
  "path": "[[workspace]]/../hugo-modules/modules/documentation",
  "contentTypes": ["component"]
}

FrontMatter complains that it does not exist (good) and offers to remove it or create it (good):

Selection_367x128_20240331-16:22:57

Clicking on "Remove Folder" results in a small notice for <1s about removing the setup, but the file is not modified or deleted.

.frontmatter/database/mediaDB.json seems to have been changed, but I am not sure if that is connected to this issue.

PS: the popup shows a different path because I tried some setup related to #787. The path is correctly displayed in the popup.

Update: it DOES actually add an empty pagefolder variable to frontmatter.json:

From:

{
  "$schema": "https://frontmatter.codes/frontmatter.schema.json",
  "frontMatter.config.dynamicFilePath": "[[workspace]]/frontmatter.config.js",
  "frontMatter.site.baseURL": "https://kollitsch.dev"
}

To:

{
  "$schema": "https://frontmatter.codes/frontmatter.schema.json",
  "frontMatter.config.dynamicFilePath": "[[workspace]]/frontmatter.config.js",
  "frontMatter.site.baseURL": "https://kollitsch.dev",
  "frontMatter.content.pageFolders": []
}

Hi @davidsneighbour, at the moment, the updates to your config are only applied to the frontmatter.json files; it does not touch the ones created you've split or extended.

It would be more of an enhancement to support this, as it requires finding the location of the config file and updating it.

I am ok with that, but the "bug" is, that IF I have a split configuration, then that popup goes into my frontmatter.json and sets the variable that might be configured in a split configuration. Do subfolder config files override the frontmatter.json or will this lead to issues down the road? Maybe a config parameter that establishes that I don't want FrontMatter to edit my config dynamically would help?

Is this:

{
  "frontMatter.content.pageFolders": []
}

ignored (or merged) if I have a .frontmatter/config/content/pagefolders/something.json file?

I know 😄

I've been implementing a change where there is a check on setting updates. When the to-be-updated setting exists in an extended config (from frontMatter.extends, config splitting, or dynamic config), it will return a warning that it cannot do it automatically and that some manual work must be performed.

The output will tell you the setting name and the value that it was trying to update.

Image

What do you think?