Issue: Can't preview index.md of hugo reaf bundle with "previewPath": "/{{pathToken.relPath}}" #474

Closed
opened 2026-10-05 02:49:12 +02:00 by adam · 3 comments
Owner

Describe the bug

Previewing of hugo bundle(index.md) fails with 404.
Generated url is wrong when setting "previewPath" to "/{{pathToken.relPath}}"

To Reproduce

frontmatter.json

  "frontMatter.content.pageFolders": [{
    "title": "content",
    "path": "[[workspace]]/content",
    "filePrefix": null,
    "previewPath": "/{{pathToken.relPath}}"
  }]

contents

$ tree content
content
└── post
    └── bundle
        └── index.md

previewing content/post/bundle/index.md leads to wrong url:
http://localhost:1313/post/bundle/bundle

Expected behavior

expected url:
http://localhost:1313/post/bundle

Desktop (please complete the following information):

  • OS: Ubuntu2204
  • vscode: 1.79.2
  • frontMatter version: v8.4.0

Additional context

The vscode-front-matter/src/commands/Preview.ts seems try to handele index as a special case,
Howevere, slug = Article.getSlug(); at line number 100 sets slag to dir name(bundle in above example)

**Describe the bug** Previewing of hugo bundle(index.md) fails with 404. Generated url is wrong when setting "previewPath" to "/{{pathToken.relPath}}" **To Reproduce** frontmatter.json ``` "frontMatter.content.pageFolders": [{ "title": "content", "path": "[[workspace]]/content", "filePrefix": null, "previewPath": "/{{pathToken.relPath}}" }] ``` contents ``` $ tree content content └── post └── bundle └── index.md ``` previewing `content/post/bundle/index.md` leads to wrong url: `http://localhost:1313/post/bundle/bundle` **Expected behavior** expected url: `http://localhost:1313/post/bundle` **Desktop (please complete the following information):** - OS: Ubuntu2204 - vscode: 1.79.2 - frontMatter version: v8.4.0 **Additional context** The `vscode-front-matter/src/commands/Preview.ts` seems try to handele `index` as a special case, Howevere, `slug = Article.getSlug();` at line number 100 sets `slag` to dir name(`bundle` in above example) <!-- github-sync-id:1800135154 -->
adam closed this issue 2026-10-05 02:49:12 +02:00
Author
Owner

Thanks, @n-arakawa, for opening this issue.

The issue here was the {{pathToken.relPath}} placeholder in combination with the location of the content.

In case when you use this placeholder, an extra check is required for page bundles.

Thanks, @n-arakawa, for opening this issue. The issue here was the `{{pathToken.relPath}}` placeholder in combination with the location of the content. In case when you use this placeholder, an extra check is required for page bundles. <!-- github-comment-id:1631984863 -->
Author
Owner

Update coming up and you will be able to test it out in the new beta.

Update coming up and you will be able to test it out in the new beta. <!-- github-comment-id:1631985785 -->
Author
Owner

Hi Elio,
looks like the issue is still there. I have installed latest Front Matter CMS v10.1.0.

// frontmatter.json
{
  "$schema": "https://frontmatter.codes/frontmatter.schema.json",
  "frontMatter.framework.id": "astro",
  "frontMatter.preview.host": "http://localhost:4321",
  "frontMatter.content.publicFolder": {
    "path": "src/assets",
    "relative": true
  },
  "frontMatter.content.pageFolders": [{
      "title": "Docs",
      "path": "[[workspace]]/src/content/docs/",
      "previewPath": "{{pathToken.relPath}}"
    }
  ]
}
$ tree content
src
└── content
    └── docs
        └── index.md // http://localhost:4321/docs -> expected http://localhost:4321/
        └── test.md // http://localhost:4321/test
            └── nested
                └── index.md // http://localhost:4321/nested // This works

If I can help out with some additional context, feel free to ask.
Have a nice day 👋

Hi Elio, looks like the issue is still there. I have installed latest Front Matter CMS `v10.1.0`. ```jsonc // frontmatter.json { "$schema": "https://frontmatter.codes/frontmatter.schema.json", "frontMatter.framework.id": "astro", "frontMatter.preview.host": "http://localhost:4321", "frontMatter.content.publicFolder": { "path": "src/assets", "relative": true }, "frontMatter.content.pageFolders": [{ "title": "Docs", "path": "[[workspace]]/src/content/docs/", "previewPath": "{{pathToken.relPath}}" } ] } ``` ```js $ tree content src └── content └── docs └── index.md // http://localhost:4321/docs -> expected http://localhost:4321/ └── test.md // http://localhost:4321/test └── nested └── index.md // http://localhost:4321/nested // This works ``` If I can help out with some additional context, feel free to ask. Have a nice day 👋 <!-- github-comment-id:2117437985 -->
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#474