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

Issue/#504 #506

Closed
wants to merge 2 commits into from
Closed

Issue/#504 #506

wants to merge 2 commits into from

Conversation

furkanb
Copy link
Contributor

@furkanb furkanb commented Feb 10, 2023

PR Details

  • Introduces the optional defaultFileName property for content types.
  • Fixes Recently Modified panel view to fallback to folder name on SvelteKit.

Description

  "frontMatter.content.pageFolders": [
    {
      "title": "Projects",
      "path": "[[workspace]]/src/routes/projects/", <---
      "filePrefix": "",
      "contentTypes": [
        "project"
      ],
      "previewPath": "'projects/'"
    }
  ],
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "project",
      "pageBundle": true,
      "defaultFileName": "+page", <---
      "fields": [
        {
          "title": "Title",
          "name": "title",
          "type": "string",
          "single": true
        }
        
    }
]

FM UI -> Create content -> with title: new title now creates:
/src/routes/projects/new-title/+page.md

Related Issue

#504

Motivation and Context

SvelteKit does not consider the index named markdown file to represent a page, instead it dictates the file name +page. This makes creating new content using the FM UI a bit problematic because the created index file should be renamed every time.

Following that I discovered that Recently Modified field which lists the files also relies on the keyword index in order to fallback to the folder name. To keep the same functionality (display folder name instead of file name) I provided a hardcoded solution which addresses my use case for now.

before after
before after

How Has This Been Tested

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

estruyf added a commit that referenced this pull request Feb 11, 2023
@estruyf
Copy link
Owner

estruyf commented Feb 11, 2023

Thanks @furkanb - I just merged this into the DEV branch and also made a change on the check for the filenames in the FileItem.tsx file.

@estruyf estruyf closed this Feb 11, 2023
@furkanb furkanb deleted the issue/#504 branch February 11, 2023 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants