Frage

I have seen in documentation that fields are not rendered in the view, and instead it can be used in helpers, partials etc. but I can't find a way how they are used. The documentation says to use it like this:

{{ cms:field:some_label }}  

But I am courios how can I use that? I wanted to be able to define some text in the snippet and then, use that field in my partial or in my helper function to form some data that will be used in the view. Can somebody tell me how can I use fields in this CMS?

War es hilfreich?

Lösung

Imagine you have a CMS site set up so it's using an application layout. Somewhere in that layout you have: <meta name="description" content="Something about the page"> Now, how do you dynamically populate content of that tag from the page? We can define {{cms:field:meta_description}} tag.

In the admin area you'll be able to populate it and. Now you need to output that like this: <meta name="description" content="<%= cms_block_content(:meta_description) %>">

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top