Any idea how I can access the fields of an item inside the variant NVelocity template? I have code inside my variant template and I'm trying to read the template fields using @Html.Sitecore().Field("Field Title") but it's not working. Is there something I'm missing?
2 Answers
In a NVelocity template you can access the fields of the current context item with $item.Fields.FieldName
where FieldName is the name of your field.
In this case, the space in your field name could become an issue. Not sure how to do that. But you could rename the field (dismiss the space) and give it a display name for the editors if you want them to see it with a space.
-
Thank you @Gatogordo for your help. yes, it works for me with fileds that has no space, however i need to apply this also to fields with spaces in the field name.Any clue?– AMECommented Jul 4, 2018 at 14:53
-
No.. I had this issue as well and renamed my field (and put the value with spaces in the title field so it appears the same to the content editors) Commented Jul 4, 2018 at 14:55