Enhancement: Add support for Git submodules #389

Closed
opened 2026-10-05 02:44:32 +02:00 by adam · 7 comments
Owner

Is your feature request related to a problem? Please describe.
When updating a frontmatter configuration that is used be several projects, I have to update each project by hand.

Describe the solution you'd like
If using Git with Front Matter I would like to be able to provide the frontmatter config as an isolated Git submodule.
(Ref: see Atlassian - Git submodules)

The config is, however, partially placed in the root folder of the Front Matter project and partially in the .frontmatter folder.
By adding support for an alternate path of the frontmatter.json file in the .frontmatter folder, the complete configuration could easily be handled as a Git submodule.

image

Describe alternatives you've considered
A webhook or a Git Server pipeline could be set to propagate changes to known destinations, but that seems like overkill in comparison. And frontmatter projects not known would never get the new versions automatically.

Additional context
Add any other context or screenshots about the feature request here.

**Is your feature request related to a problem? Please describe.** When updating a frontmatter configuration that is used be several projects, I have to update each project by hand. **Describe the solution you'd like** If using Git with Front Matter I would like to be able to provide the frontmatter config as an isolated Git submodule. (Ref: see [Atlassian - Git submodules](https://www.atlassian.com/git/tutorials/git-submodule)) The config is, however, partially placed in the root folder of the Front Matter project and partially in the .frontmatter folder. By adding support for an alternate path of the frontmatter.json file in the .frontmatter folder, the complete configuration could easily be handled as a Git submodule. ![image](https://user-images.githubusercontent.com/20666032/210548385-b4f8730a-5c34-43c8-a940-cef8a9cad9c9.png) **Describe alternatives you've considered** A webhook or a Git Server pipeline could be set to propagate changes to *known* destinations, but that seems like overkill in comparison. And frontmatter projects not known would never get the new versions automatically. **Additional context** Add any other context or screenshots about the feature request here. <!-- github-sync-id:1527162757 -->
adam closed this issue 2026-10-05 02:44:32 +02:00
Author
Owner

Thanks, @DennisL68 for this idea. Would it work with the following enhancement: https://github.com/estruyf/vscode-front-matter/issues/407 ?

It allows you to define a file that can be located in a folder or online. That should work with your use-case I believe. The only thing you need to add, in that case, is the frontmatter.json file with:

{
  "$schema": "https://beta.frontmatter.codes/frontmatter.schema.json",
  "frontMatter.extends": [
    "./.frontmatter/submodule.json"
  ]
}
Thanks, @DennisL68 for this idea. Would it work with the following enhancement: https://github.com/estruyf/vscode-front-matter/issues/407 ? It allows you to define a file that can be located in a folder or online. That should work with your use-case I believe. The only thing you need to add, in that case, is the `frontmatter.json` file with: ```json { "$schema": "https://beta.frontmatter.codes/frontmatter.schema.json", "frontMatter.extends": [ "./.frontmatter/submodule.json" ] } ``` <!-- github-comment-id:1414274754 -->
Author
Owner

Ok, no. Not really.

Submodules in git works "the other way around". They are subfolders in the git repo that are actually controller by another repo.
The frontmatter.json must in that case be placed within the .frontmatter folder (that can then be handled as a submodule).

When working with git you can't make sure external references are available. All files needs to be placed locally and each repo have it's own point of origin.

graph TD
A(Frontmatter - Git Origin)
B[Project with Frontmatter]
C[Frontmatter submodule]
D[Project - Git Origin]

subgraph Local Folder
B --o C
end
A --->|Git Pull/Push| C

D -->|Git Pull/Push| B
Ok, no. Not really. Submodules in git works "the other way around". They are subfolders in the git repo that are actually controller by another repo. The frontmatter.json must in that case be placed within the `.frontmatter` folder (that can then be handled as a submodule). When working with git you can't make sure external references are available. All files needs to be placed locally and each repo have it's own point of origin. ```mermaid graph TD A(Frontmatter - Git Origin) B[Project with Frontmatter] C[Frontmatter submodule] D[Project - Git Origin] subgraph Local Folder B --o C end A --->|Git Pull/Push| C D -->|Git Pull/Push| B ``` <!-- github-comment-id:1430301226 -->
Author
Owner

@DennisL68 this is indeed what the extend is actually doing. You can add a submodule in any folder for instance a config folder.

In the frontmatter.json file, you just reference the config/<file>.

This means, that in your project with Front Matter, you will have to put the config/<file> reference in the frontmatter.json file. In your submodule, you can add all the configuration you want.

@DennisL68 this is indeed what the extend is actually doing. You can add a submodule in any folder for instance a `config` folder. In the `frontmatter.json` file, you just reference the `config/<file>`. This means, that in your project with Front Matter, you will have to put the `config/<file>` reference in the `frontmatter.json` file. In your submodule, you can add all the configuration you want. <!-- github-comment-id:1430941410 -->
Author
Owner

Ok, so you are saying that the Frontmatter.json can be left empty and refer all settings to what's stored within the .Frontmatter folder?

Is it possible to have Frontmatter look for that file within the .frontmatter folder first and then, as a fallback, check the root folder of the Frontmatter project?

Then git submodules would be supported regardless how you chose to structure your Frontmatter settings...

Ok, so you are saying that the Frontmatter.json can be left empty and refer all settings to what's stored within the .Frontmatter folder? Is it possible to have Frontmatter look for that file within the .frontmatter folder first and then, as a fallback, check the root folder of the Frontmatter project? Then git submodules would be supported regardless how you chose to structure your Frontmatter settings... <!-- github-comment-id:1430990612 -->
Author
Owner

The only thing you should have in your frontmatter.json would be the following config:

{
  "$schema": "https://frontmatter.codes/frontmatter.schema.json",
  "frontMatter.extends": [
    "./.frontmatter/config.json"
  ]
}

The rest can then be done from your submodule.

The only thing you should have in your `frontmatter.json` would be the following config: ```json { "$schema": "https://frontmatter.codes/frontmatter.schema.json", "frontMatter.extends": [ "./.frontmatter/config.json" ] } ``` The rest can then be done from your submodule. <!-- github-comment-id:1431007469 -->
Author
Owner

Yes, that will work :)

But you are still storing a part of the Frontmatter settings (the referral) outside of the git sub module (i.e. the .Frontmatter folder).

That means that you need to

  1. Clone the submodule
  2. Change Frontmatter.json to use the submodule

If Frontmatter would start with looking for Frontmatter.json within the .Frontmatter folder (I.e. the git submodule), you only need to clone the git repo as a submodule and you are all set :)

Yes, that will work :) But you are still storing a part of the Frontmatter settings (the referral) outside of the git sub module (i.e. the .Frontmatter folder). That means that you need to 1. Clone the submodule 2. Change Frontmatter.json to use the submodule If Frontmatter would start with looking for Frontmatter.json within the .Frontmatter folder (I.e. the git submodule), you only need to clone the git repo as a submodule and you are all set :) <!-- github-comment-id:1431059401 -->
Author
Owner

The last request to allow you to place the frontmatter.json file in a sub-directory and load it, will come in the next version. https://github.com/estruyf/vscode-front-matter/issues/676

The last request to allow you to place the `frontmatter.json` file in a sub-directory and load it, will come in the next version. https://github.com/estruyf/vscode-front-matter/issues/676 <!-- github-comment-id:1744855835 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#389