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

Placeholder support for fields #450

Closed
bdot opened this issue Jun 14, 2017 · 5 comments
Closed

Placeholder support for fields #450

bdot opened this issue Jun 14, 2017 · 5 comments

Comments

@bdot
Copy link

bdot commented Jun 14, 2017

- Do you want to request a feature or report a bug?

This is a feature request

- What is the current behavior?
Currently placeholders are not supported at field level. That is we can have a slug something like below at collection level but it doesn't work if used at field level.

slug: "{{year}}-{{month}}-{{day}}-{{slug}}"

- What is the expected behavior?
For example having a Field definition:

- {label: "Slug", name: "slug", widget: "hidden", default: "{{slug}}"}

Should produce an entry in the actual document body
Expected outcome in the body for an article titled "Netlify CMS is awesome" should be

slug: netlify-cms-is-awesome
@erquhart
Copy link
Contributor

The slug placeholder is very specific to slugs - maybe we should consider just putting slugs in the frontmatter? Not certain if that would negatively affect various build tools.

The ability to edit slugs is covered under #445.

@dardub
Copy link
Contributor

dardub commented Oct 4, 2017

In Gatsby it's very common pattern to use the slug in the frontmatter. Right now I think we have to create the slug independently to use in Gatsby.

So adding the slug to frontmatter in some way would help Gatsby integration at the very least.

Edit:

I think in the use-case for gatsby. Allowing the use of template placeholders would be helpful.

So for a news collection I may want a field with the path 'news/{{slug}}'.
But for a gallery collection I may want the path 'gallery/{{slug}}'.

@anarchivist
Copy link

Slugs in frontmatter is also common for Jekyll; see https://jekyllrb.com/docs/permalinks/#template-variables for more details.

@stale
Copy link

stale bot commented Oct 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label Oct 29, 2019
@martinjagodic
Copy link
Member

Closing as stale and/or outdated.

@martinjagodic martinjagodic closed this as not planned Won't fix, can't repro, duplicate, stale Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants