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.99k stars 83 forks source link

frontMatter.preview.host Feedback #254

Closed grahampcharles closed 7 months ago

grahampcharles commented 2 years ago

The frontMatter.preview.host setting does not work in the manner that it is documented on this page. If I set that value to http://localhost:1313 as instructed (this is a hugo site), the preview attempts to load http://localhost:1313/pagename and gets a 404. Hugo's default permalink is /:section/:title/, though, which of course can be overridden in the configuration. Front Matter appears not to take that into account.

I have verified that the page does actually load at localhost:1313/section/pagename.


Document Details

Do not edit this section

estruyf commented 2 years ago

Thanks @grahampcharles, that setting is to specify the base host location, if you want to further configure the sections/paths, you can check the following part of the documentation: https://frontmatter.codes/docs/content-types#preview-path

There are actually two other options to specify the path for your content:

  1. Via the content type
  2. Via the frontMatter.preview.pathName setting
grahampcharles commented 2 years ago

Thank you! That part of the documentation does not indicate how to use the equivalent of :section or :slug in the preview.pathName setting.

Since hugo already has a permalink setting, I'm curious as to why FM doesn't just use that? A separate previewPath setting seems duplicative (or maybe I'm missing something?).

estruyf commented 2 years ago

FM is intended to work on any SSG, but it makes sense as well to retrieve settings from the SSG. Why FM doesn't use it yet? Just because you are the first that mentions it, so it would be a good enhancement to FM to be more SSG aware.

grahampcharles commented 2 years ago

I see! Thank you for your response.

estruyf commented 2 years ago

@grahampcharles we can keep the issue open, as this is a good enhancement for one of the upcoming version

estruyf commented 7 months ago

The CMS now has more capabilities to use front matter values in order for previews, and they can be defined on global, page folder, and content type levels.