pages-cms icon indicating copy to clipboard operation
pages-cms copied to clipboard

Auto populate select field

Open akhyarrh opened this issue 1 year ago • 0 comments

I'm still using Prose because of this feature. Basically it load a jsonp file and populate multiselect field with it & also I'm able to add new entry if it dont exist yet.

Prose config

# prose config
name: "tags"
field:
  element: "multiselect"
  label: "Tags"
  alterable: true
  options: "https://akhyarrh.github.io/tags.jsonp?callback=tags"

tags.jsonp file for jekyll to render

---
layout: none
---
tags([
{% for tag in site.tags %}
  {
    "name": "{{ tag[0] | capitalize }}",
    "value": "{{ tag[0] }}"
  }{% unless forloop.last %},{% endunless%}
{% endfor %}
])

tags.jsonp on deployed site

tags([
{ "name": "Catatan", "value": "catatan" },
{ "name": "Android", "value": "android" },
{ "name": "Tips", "value": "tips" },
{ "name": "Security", "value": "security" },
{ "name": "Jekyll", "value": "jekyll" },
... ])

Selecting a tags for a post Screenshot_20241012_001316

akhyarrh avatar Oct 11 '24 16:10 akhyarrh