Search code examples
ruby-on-railsrefinerycms

How can I stop RefineryCMS from adding <p> tags around text?


I created a controller for "products" to be added into my app that is utilizing the Refinery CMS.

Hhere is the code for the page in show.html.erb

<div>
  <h3>Feedback Sought</h3>
  <p>
    <%=raw @product.description %>
  </p>
</div>


But this is what is actually produced in the live page.

dynamic code

For the meantime I can implement a digsuting hack of removing the margin by targeting the element, like

.productFeedbackDescription p { margin: 0; }

and then doing inline css along the lines of

<p style="margin-bottom: 12px;">
  <%=raw @product.description %>
</p>

Solution

  • By default Refinery adds <p> tags in the template.

    And by default, using the WYSIWYG editor also adds <p> tags. So I manually removed the <p> tags from the template.

    For reference, this was the default code generated by refinery when I create the controller

    <section>
      <h1>Product Summary</h1>
      <p>
        <%=raw @product.product %>
      </p>
    </section>
    

    Now my code is

    <div>
      <h3>Product Summary</h3>
      <%=raw @product.product %>
    </div> 
    

    Here is a screenshot of the code now generated as live in page.

    page now