pages-cms
pages-cms copied to clipboard
Auto populate select field
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