user
user

Reputation: 1381

Rails fb open graph description

How to remove html tags from open graph description

meta property='og:description' content="#{@post.text}"

enter image description here

i have tried to add raw and html_safe to @post.text but it doesn't help

raw(@post.text) ,@post.text.html_safe

Upvotes: 0

Views: 88

Answers (1)

codyeatworld
codyeatworld

Reputation: 1283

You can use strip_tags to remove tags from a string.

strip_tags(@post.text)

raw and html_safe will escape html characters.

html_safe: http://edgeapi.rubyonrails.org/classes/String.html#method-i-html_safe
raw: http://api.rubyonrails.org/classes/ActionView/Helpers/OutputSafetyHelper.html#method-i-raw

Upvotes: 1

Related Questions