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

Open
bdot opened this issue Jun 14, 2017 · 4 comments
Open

Placeholder support for fields #450

bdot opened this issue Jun 14, 2017 · 4 comments

Comments

@bdot
Copy link

@bdot 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

This comment has been minimized.

Copy link
Member

@erquhart erquhart commented Jun 28, 2017

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

This comment has been minimized.

Copy link
Contributor

@dardub 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}}'.

@erquhart erquhart added kind: feature and removed improvement labels Dec 8, 2017
@anarchivist

This comment has been minimized.

Copy link

@anarchivist anarchivist commented Jan 6, 2018

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

@stale

This comment has been minimized.

Copy link

@stale 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.