FEATURE: include published_time in metadata
This commit is contained in:
parent
c7c84606d9
commit
dfcb2a0d42
|
@ -237,6 +237,10 @@ module ApplicationHelper
|
||||||
result << tag(:meta, name: 'twitter:data2', value: "#{opts[:like_count]} ❤")
|
result << tag(:meta, name: 'twitter:data2', value: "#{opts[:like_count]} ❤")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts[:published_time]
|
||||||
|
result << tag(:meta, property: 'article:published_time', content: opts[:published_time])
|
||||||
|
end
|
||||||
|
|
||||||
if opts[:ignore_canonical]
|
if opts[:ignore_canonical]
|
||||||
result << tag(:meta, property: 'og:ignore_canonical', content: true)
|
result << tag(:meta, property: 'og:ignore_canonical', content: true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title><%= @topic_view.topic.title %></title>
|
<title><%= @topic_view.topic.title %></title>
|
||||||
<%= raw crawlable_meta_data(title: @topic_view.title, description: @topic_view.summary(strip_images: true), image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count) %>
|
<%= raw crawlable_meta_data(title: @topic_view.title, description: @topic_view.summary(strip_images: true), image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count, published_time: @topic_view.published_time) %>
|
||||||
<% if @topic_view.prev_page %>
|
<% if @topic_view.prev_page %>
|
||||||
<link rel="prev" href="<%= @topic_view.prev_page_path -%>">
|
<link rel="prev" href="<%= @topic_view.prev_page_path -%>">
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
|
|
||||||
<% content_for :head do %>
|
<% content_for :head do %>
|
||||||
<%= auto_discovery_link_tag(@topic_view, {action: :feed, slug: @topic_view.topic.slug, topic_id: @topic_view.topic.id}, title: t('rss_posts_in_topic', topic: @topic_view.title), type: 'application/rss+xml') %>
|
<%= auto_discovery_link_tag(@topic_view, {action: :feed, slug: @topic_view.topic.slug, topic_id: @topic_view.topic.id}, title: t('rss_posts_in_topic', topic: @topic_view.title), type: 'application/rss+xml') %>
|
||||||
<%= raw crawlable_meta_data(title: @topic_view.title, description: @topic_view.summary(strip_images: true), image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count, ignore_canonical: true) %>
|
<%= raw crawlable_meta_data(title: @topic_view.title, description: @topic_view.summary(strip_images: true), image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count, ignore_canonical: true, published_time: @topic_view.published_time) %>
|
||||||
|
|
||||||
<% if @topic_view.prev_page || @topic_view.next_page %>
|
<% if @topic_view.prev_page || @topic_view.next_page %>
|
||||||
<% if @topic_view.prev_page %>
|
<% if @topic_view.prev_page %>
|
||||||
|
|
|
@ -193,6 +193,11 @@ class TopicView
|
||||||
@topic.like_count
|
@topic.like_count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def published_time
|
||||||
|
return nil if desired_post.blank?
|
||||||
|
desired_post.created_at.strftime('%FT%T%:z')
|
||||||
|
end
|
||||||
|
|
||||||
def image_url
|
def image_url
|
||||||
if @post_number > 1 && @desired_post.present?
|
if @post_number > 1 && @desired_post.present?
|
||||||
if @desired_post.image_url.present?
|
if @desired_post.image_url.present?
|
||||||
|
|
Loading…
Reference in New Issue