Home how to share post description using fb meta og tag
Reply: 0

how to share post description using fb meta og tag

user1318
1#
user1318 Published in June 19, 2018, 6:28 pm

i want to share my post to facebook share using og meta. everything works fine except post's description

i tried to put <meta property='og:description' content="<%= @post.description %>"></meta> ,but i got an error undefined method description..

here's my codes,, please solve this thx u guys

in my application.html.erb

<html prefix="og: http://ogp.me/ns#">
      <head>
        <title><%= yield(:page_title) %></title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta property="fb:app_id" content="<%= 1234567890 %>"></meta>
        <meta property="og:url" content="<%= request.original_url %>"></meta>
        <meta property='og:description' content="#{@post.description}"></meta>
        <meta property="og:type" content="website"></meta>
        <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
        <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
        <%= stylesheet_link_tag 'application', href="https://fonts.googleapis.com/css?family=Raleway:400,700" %>
    </head>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.33714 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO