Closed apexdodge closed 1 year ago
This code would pull out the categories
field on the posts
content type and loop through the choices in the drop down box and gets the developer name and outputs links accordingly.
{% assign contentType = get_content_type_by_developer_name('posts') %}
{% assign categoriesField = contentType.ContentTypeFields | where: "DeveloperName", "categories" | first %}
{{ contentType | json }}
<hr/>
{% for choice in categoriesField.Choices %}
<a href="{{ PathBase }}/{{ category.DeveloperName }}">{{ choice.Label }}</a>
{% endfor %}
We should add a new custom liquid function for getting content type by developer name.
Example usage:
This would be very useful if you want to create dynamic sidebar menus for things like filtering and sorting by the different field types. Otherwise you have to hardcode the values.
To be added here: https://github.com/RaythaHQ/raytha/blob/d28475fda4ce56aa8166bf6f9785ae646f72f662/src/Raytha.Web/Services/RenderEngine.cs#L105