From a611e73bed32d68d8a189f9facf72d020fa98ca8 Mon Sep 17 00:00:00 2001 From: ludivinecp Date: Mon, 14 Dec 2015 10:07:31 +0100 Subject: [PATCH] Opengraph facebook: images and description for shops and groups and home => ok --- app/assets/images/logo-black2.png | Bin 0 -> 2082 bytes app/helpers/application_helper.rb | 4 ++++ app/views/enterprises/shop.html.haml | 4 ++++ app/views/groups/show.html.haml | 4 ++++ app/views/layouts/darkswarm.html.haml | 4 +++- config/locales/en.yml | 2 ++ 6 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 app/assets/images/logo-black2.png diff --git a/app/assets/images/logo-black2.png b/app/assets/images/logo-black2.png new file mode 100644 index 0000000000000000000000000000000000000000..6229ae2d9ef1c7889bcd5e5ef8df7490d26c0e8f GIT binary patch literal 2082 zcmb7FYdDjQA6_XkQBlszA#>Ox>okRzQqDpxTOJD?o{8qz9J8jw+e<`Fn^&w7Q?@7Z zI3<##cqbLHvbRx6-XTN|%~pSX{C|7j`?`MDecku(zV0u-55LO?yj@k%x@Z&%rRwhH zL`0#M`=L{ci&IWsLoe=HI1zV!&N ziE&#J%29409feZS_%+K=*NU{4Or;oiFK4B})v9aF^aX8WACe+@LkREbhp@+POwYb=Ft2)P6+XWXKPd_Az%ScVzc3rZ@y`&=2V3 zL&I5c*!cX6xS(7`nbGX=vL2!aEh=7=HJ}TU9jZz`PR)2i&aG!606PT1dMY8jeD>9v z35#T_6O#B0hdE<;e2u77?Sa~}%pEKrCXqbFQ9!Q$l-^4j*<>-;lFRLyBpUq2J=Jt0 z2mAO$XIuID0(l-b6J{I)KV)t6+)R}i0T{1SAla76^(ITNSSrW+KcoCe2BifpJv+m2 z&IS~IaEPF1CHNrS5)6?)d4*6Dl^x9at6BmeiQTOOX^xfNjcUosda)R5R&9)*&ZQ3& zDmRcUZL$RI6xZwpl8_=Lt-RV@%zQ1#M#1@EktO)$-S@u-_pvLQk9x5|SuP;(Hz3@< z7p2}5aB&jXrLEQeByQaHJ|fdiy;4SydY5-63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v6HF&*ke#)=sqn$`!EwVEfzeCK+460KRSI?^ePNGV7mc zLJd_daqXwKJv$yf(yh~0Z{BvROgP1}@_icq0SBv)`0_*l;S2tM^j!RuQm?$Cux2Q) Q^4G@Q+1sgN@6ikY1E^uT^#A|> literal 0 HcmV?d00001 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 15c20dfd55..80b4a5d4d1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -25,4 +25,8 @@ module ApplicationHelper super end end + + def image_url(file) + request.protocol + request.host_with_port + path_to_image(file) + end end diff --git a/app/views/enterprises/shop.html.haml b/app/views/enterprises/shop.html.haml index 35937629fc..d3169647e0 100644 --- a/app/views/enterprises/shop.html.haml +++ b/app/views/enterprises/shop.html.haml @@ -1,5 +1,9 @@ - content_for(:title) do = current_distributor.name +- content_for(:description) do + = current_distributor.description +- content_for(:image) do + = current_distributor.logo = inject_enterprises diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index b4e6f7586c..ed98d3b2ca 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -1,5 +1,9 @@ - content_for(:title) do = @group.name +- content_for(:description) do + = @group.description +- content_for(:image) do + = @group.logo -# inject all enterprises as "enterprises" -# it could be more efficient to inject only the enterprises that are related to the group diff --git a/app/views/layouts/darkswarm.html.haml b/app/views/layouts/darkswarm.html.haml index a933858049..016af8d30d 100644 --- a/app/views/layouts/darkswarm.html.haml +++ b/app/views/layouts/darkswarm.html.haml @@ -2,7 +2,9 @@ %head %meta{charset: 'utf-8'}/ %meta{name: 'viewport', content: "width=device-width,initial-scale=1.0"}/ - + %meta{:content => yield(:title).empty? ? "#{t(:title)}" : yield(:title), :property => "og:title"}/ + %meta{:content => yield(:description).empty? ? "#{t(:og_description)}" : yield(:description), :property => "og:description"}/ + %meta{:content => yield(:image).empty? ? image_url("logo-black2.png") : image_url(yield(:image)), :property => "og:image"}/ %title= content_for?(:title) ? "#{yield(:title)} - #{t(:title)}".html_safe : "#{t(:welcome_to)} #{t(:title)}" - if Rails.env.production? = favicon_link_tag diff --git a/config/locales/en.yml b/config/locales/en.yml index 76f0c124b3..963cf0edff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -674,3 +674,5 @@ Please follow the instructions there to make your enterprise visible on the Open price_graph: "Price graph" included_tax: "Included tax" remove_tax: "Remove tax" + og_description: "We begin from the ground up. With farmers and growers ready to tell their stories proudly and truly. With distributors ready to connect people with products fairly and honestly. With buyers who believe that better weekly shopping decisions can…" +