<%- site_link = raw(@markdown_linker.create(@site_name, '/')) %>
<%= raw(t 'user_notifications.digest.why',
      site_link: site_link,
      last_seen_at: @last_seen_at) %>

<%- @counts.each do |count| -%>
<%= count[:value] -%> <%=t count[:label_key] %>
<%- end -%>

--------------------------------------------------------------------------------

<%- if @popular_topics.present? %>
### <%=t 'user_notifications.digest.popular_topics' %>

<%- @popular_topics.each_with_index do |t,i| %>
<%= raw(@markdown_linker.create(t.title, t.url)) %>

<%- if t.best_post.present? %>
 <%= raw(t.best_post.excerpt(1000, strip_links: true, text_entities: true, markdown_images: true)) %>
--------------------------------------------------------------------------------

<%- end %>
<%= digest_custom_text("below_post_#{i+1}") %>
<%- end %>
<%- end %>
<%= digest_custom_text("above_popular_topics") %>

<%- if @popular_posts.present? %>
### <%=t 'user_notifications.digest.popular_posts' %>

<%- @popular_posts.each_with_index do |post,i| %>
<%= post.user.username -%> - <%= raw(@markdown_linker.create(post.topic.title, post.topic.url)) %>

 <%= raw(post.excerpt(1000, strip_links: true, text_entities: true, markdown_images: true)) %>
--------------------------------------------------------------------------------

<%- end %>
<%- end %>

<%- if @other_new_for_you.present? %>
**<%=t 'user_notifications.digest.more_new' %>**

<%- @other_new_for_you.each do |t| %>
* <%= raw(@markdown_linker.create(t.title, t.url)) %> - <%= t.posts_count %> - <%- if t.category %>[<%= t.category.name %>]<%- end %>
<%- end -%>
<%- end %>

<%= digest_custom_text("below_popular_topics") %>

<%= raw(@markdown_linker.references) %>

<%= digest_custom_text("above_footer") %>
<%=raw(t :'user_notifications.digest.unsubscribe',
     site_link: site_link,
     email_preferences_link: raw(@markdown_linker.create(t('user_notifications.digest.your_email_settings'), '/my/preferences/emails')),
     unsubscribe_link: raw(@markdown_linker.create(t('user_notifications.digest.click_here'), "/email/unsubscribe/#{@unsubscribe_key}")))  %>

<%= raw(@markdown_linker.references) %>

<%= digest_custom_text("below_footer") %>
