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.95k stars 77 forks source link

Enhancement: Globbing (?) for pagefolder setup #787

Closed davidsneighbour closed 5 months ago

davidsneighbour commented 6 months ago

I recently moved the documentation of modules in a mono repo from one single folder into multiple folders within the modules.

Before:

|- documentation
|- modules
  |- module 1
  |- module 2

Now:

|- modules
  |- module 1
    |- documentation
  |- module 2
    |- documentation

It would be nice if I could configure FrontMatter like this:

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

The documentation folder is always on the same level; it's a variable amount of subfolders in that path, though (module 1 to module n).

Alternatively, maybe add all folders called documentation inside of modules? But that might lead to issues.

estruyf commented 6 months ago

Hi @davidsneighbour, I will include it in the upcoming version.

One small detail: The wildcard notation for folders uses a double asterisk **.

{
  "$schema": "https://frontmatter.codes/config/content.pagefolders.schema.json",
  "title": "Components",
  "path": "[[workspace]]/modules/**/documentation",
  "contentTypes": ["component"]
}
estruyf commented 6 months ago

The above configuration should be testable in the latest beta version.

davidsneighbour commented 6 months ago

I did that:

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

But the dashboard window stays grayed out, and the loading indicator on top is running. Ubuntu 22.04 with latest VSCode. There is nothing in the logs that indicates issues, just page updates.

["INFO" - 22:04:08] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:09] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:13] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:14] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:15] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:18] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:19] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:20] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:20] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:48] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:50] Trigger page update: onDidChangeActiveTextEditor ["INFO" - 22:04:34] Trigger page update: onDidChangeActiveTextEditor ["INFO" - 22:04:34] Sending message to panel: mediaSelectionData ["INFO" - 22:04:36] Trigger page update: onDidChangeActiveTextEditor ["INFO" - 22:04:36] Trigger page update: onDidChangeActiveTextEditor ["INFO" - 22:04:37] Trigger page update: onDidChangeActiveTextEditor ["INFO" - 22:04:37] Trigger page update: onDidChangeActiveTextEditor ["INFO" - 22:04:39] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:02] Trigger page update: onDidChangeActiveTextEditor ["INFO" - 22:04:06] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:07] Trigger page update: onDidChangeTextEditorSelection ["INFO" - 22:04:09] Trigger page update: onDidChangeTextEditorSelection

estruyf commented 6 months ago

I just tested it without any issues. Can you verify that you have at least BETA version 10.1.8508508 installed?

estruyf commented 6 months ago

You can also run the Front Matter: Diagnostic logging command. It should show you the page folders it retrieved at the top.

https://frontmatter.codes/docs/troubleshooting#inspecting-configuration-behavior

davidsneighbour commented 6 months ago

You are right; with a proper restart, it worked. I will pledge to always restart first in the future ;)