Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Automation for creating a document and placing it in a configurable subfolder based on the title or date #825

Open
jorgemartinezgomez opened this issue Jun 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jorgemartinezgomez
Copy link

Problem:

A website with thousands of documents in a collection becomes unmanageable if all documents are stored in the same folder, potentially exceeding the maximum number of files per folder allowed by the operating system.

To avoid this issue, subfolders are created within the main collection folder. The idea is to have a system that automatically creates the folder structure where the newly created document will be placed, based on the file name, similar to the "filePrefix" property but for automatically and configurable directory creation.

Proposed Solution:

Create a configuration parameter "subdir" where a template using placeholders can be configured.

For example, with this configuration:

{
  "frontMatter.content.pageFolders": [
    {
      "title": "Blog",
      "subdir": "{{year}}/{{month}}",
      "path": "[[workspace]]/src/content/blog"
    }
  ]
}

When creating a document titled "post," it would be generated in the folder "/src/content/blog/2024/06/post.md".

Additionally, it should be possible to use custom placeholders. For example, creating a placeholder that returns the first few characters of the title as a directory.

"subdir": "{{customPlaceholder}}"

We would create a script associated with the "customPlaceholder" that generates directories from the first few numbers: customPlaceholder(15678) => "1/5/6/7/".

So, if we created a document titled "345," it would be generated in the folder "/src/content/blog/3/4/345.md".

@jorgemartinezgomez jorgemartinezgomez added the enhancement New feature or request label Jun 27, 2024
@estruyf estruyf added this to v10.7.0 Jul 3, 2024
@estruyf estruyf moved this to Backlog in v10.7.0 Jul 3, 2024
@project-labels project-labels bot added v10.3.0 Project: v10.3.0 Backlog This item hasn't been started labels Jul 3, 2024
@estruyf estruyf removed Backlog This item hasn't been started v10.3.0 Project: v10.3.0 labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants