diff --git a/plugins/metadata/lib/ext/article.rb b/plugins/metadata/lib/ext/article.rb index e864363..1d0a318 100644 --- a/plugins/metadata/lib/ext/article.rb +++ b/plugins/metadata/lib/ext/article.rb @@ -23,14 +23,14 @@ class Article 'locale:locale' => proc{ |a, c| a.language || a.environment.default_language }, 'locale:alternate' => proc{ |a, c| a.alternate_languages }, - description: proc{ |a, plugin| ActionView::Base.full_sanitizer.sanitize a.body }, + description: proc{ |a, plugin| ActionView::Base.full_sanitizer.sanitize a.lead }, rich_attachment: "", } metadata_spec namespace: :twitter, key_attr: :name, tags: { card: 'summary', description: proc do |a, plugin| - description = a.body.to_s || a.environment.name + description = a.lead.to_s || a.environment.name plugin.helpers.truncate plugin.helpers.strip_tags(description), length: 200 end, title: proc{ |a, plugin| "#{a.title} - #{a.profile.name}" }, diff --git a/plugins/metadata/test/functional/content_viewer_controller_test.rb b/plugins/metadata/test/functional/content_viewer_controller_test.rb index 58e4d20..84f8299 100644 --- a/plugins/metadata/test/functional/content_viewer_controller_test.rb +++ b/plugins/metadata/test/functional/content_viewer_controller_test.rb @@ -23,18 +23,18 @@ class ContentViewerControllerTest < ActionController::TestCase end should 'add meta tags with article info' do - a = TinyMceArticle.create(name: 'Article to be shared', body: 'This article should be shared with all social networks', profile: profile) + a = TinyMceArticle.create(name: 'Article to be shared', body: '

This article should be shared with all social networks

', profile: profile) get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] assert_tag tag: 'meta', attributes: { name: 'twitter:title', content: /#{a.name} - #{a.profile.name}/ } - assert_tag tag: 'meta', attributes: { name: 'twitter:description', content: a.body } + assert_tag tag: 'meta', attributes: { name: 'twitter:description', content: a.lead.gsub(/<\/?p>/,'') } assert_no_tag tag: 'meta', attributes: { name: 'twitter:image' } assert_tag tag: 'meta', attributes: { property: 'og:type', content: 'article' } assert_tag tag: 'meta', attributes: { property: 'og:url', content: /\/#{profile.identifier}\/#{a.name.to_slug}/ } assert_tag tag: 'meta', attributes: { property: 'og:title', content: /#{a.name} - #{a.profile.name}/ } assert_tag tag: 'meta', attributes: { property: 'og:site_name', content: a.profile.name } - assert_tag tag: 'meta', attributes: { property: 'og:description', content: a.body } + assert_tag tag: 'meta', attributes: { property: 'og:description', content: a.lead.gsub(/<\/?p>/,'') } assert_no_tag tag: 'meta', attributes: { property: 'og:image' } end -- libgit2 0.21.2