pollen-users
pollen-users copied to clipboard
Adding tags in the sense of categories?
One common use that I couldn’t find easily described in the tutorials is creating tags for content such as are present in e.g. WordPress. (Meaning, not XML tags or tag functions, but tags like metadata applying to multiple items in a hierarchy).
E.g., you might tag a document “legal”, “update”, “technology”, etc.
I realize this is probably very basic Racket that I’m misunderstanding.
The best way I could guess to do this would be to add ◊(define-meta)
at the
top of a document and give it a list.
◊(define-meta my-tags '("legal" "update" "technology"))
Then in a template.html.pm
, use something like
<ul>
◊(map ◊li{◊select*['my-tags metas]})
</ul>
This doesn’t work because something about the syntax is incorrect, but is it on the right track?
You should use
◊(define-meta my-tags ("legal" "update" "technology"))
because the RHS of define-meta
is auto-quoted.
For template.html.p
, you probably should have something like:
◊(->html (apply ul (map li (select-from-metas 'my-tags metas))))
@sorawee It works! Thank you.
I also found out you can do it with for/splice
something like:
◊for/splice[[(item (in-list (select* 'my-tags metas)))]]{
<div>◊|item|</div>
}
I found it odd that the auto-quoting of define-metas
was not documented. Thanks for the tip.