Module: Workarea::Storefront::BlogsHelper

Defined in:
app/helpers/workarea/storefront/blogs_helper.rb

Instance Method Summary collapse

Instance Method Details

#blog_posting_schema(entry) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/workarea/storefront/blogs_helper.rb', line 4

def blog_posting_schema(entry)
  {
    '@context': 'http://schema.org',
    '@type': 'BlogPosting',
    'url': blog_entry_url(entry),
    'image': entry.thumbnail_image_url.presence,
    'mainEntityOfPage': true,
    'headline': entry.name,
    'dateCreated': entry.created_at.to_date,
    'datePublished': entry.written_at.to_date,
    'dateModified': entry.updated_at.to_date,
    'commentCount': entry.comment_count,
    'keywords': entry.tags,
    'publisher': {
      '@type': 'Organization',
      'name': Workarea.config.site_name,
      'url': root_url,
      'logo': image_url('workarea/storefront/logo.png')
    },
    'author': {
      '@type': 'Person',
      'name': entry.author
    },
    'articleBody': strip_tags(
      render_content_blocks(
        entry.content_blocks_for('blog_content')
      ).html_safe
    ),
    comment: entry.comments.map do |comment|
      {
        '@type': 'Comment',
        'author': comment.,
        'dateCreated': comment.created_at.to_date,
        'text': comment.body
      }
    end
  }
end