Pergunta

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?

Foi útil?

Solução

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) %>">

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top