add schema.org metatags
This commit is contained in:
@@ -21,7 +21,7 @@ class PostPresenter < Presenter
|
||||
|
||||
path = options[:path_prefix] || "/posts"
|
||||
|
||||
html = %{<article id="post_#{post.id}" class="#{preview_class(post, options[:pool])}" #{data_attributes(post)}>}
|
||||
html = %{<article itemscope itemtype="http://schema.org/ImageObject" id="post_#{post.id}" class="#{preview_class(post, options[:pool])}" #{data_attributes(post)}>}
|
||||
if options[:tags].present?
|
||||
tag_param = "?tags=#{CGI::escape(options[:tags])}"
|
||||
elsif options[:pool_id] || options[:pool]
|
||||
@@ -32,7 +32,7 @@ class PostPresenter < Presenter
|
||||
tag_param = nil
|
||||
end
|
||||
html << %{<a href="#{path}/#{post.id}#{tag_param}">}
|
||||
html << %{<img src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
|
||||
html << %{<img itemprop="thumbnailUrl" src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
|
||||
html << %{</a>}
|
||||
|
||||
if options[:pool]
|
||||
|
||||
@@ -12,7 +12,7 @@ class TagSetPresenter < Presenter
|
||||
def tag_list_html(template, options = {})
|
||||
html = ""
|
||||
if @tags.present?
|
||||
html << "<ul>"
|
||||
html << '<ul itemscope itemtype="http://schema.org/ImageObject">'
|
||||
@tags.each do |tag|
|
||||
html << build_list_item(tag, template, options)
|
||||
end
|
||||
@@ -112,7 +112,12 @@ private
|
||||
|
||||
humanized_tag = tag.tr("_", " ")
|
||||
path = options[:path_prefix] || "/posts"
|
||||
html << %{<a class="search-tag" href="#{path}?tags=#{u(tag)}">#{h(humanized_tag)}</a> }
|
||||
if categories[tag] == Tag.categories.artist
|
||||
itemprop = 'itemprop="author"'
|
||||
else
|
||||
itemprop = nil
|
||||
end
|
||||
html << %{<a class="search-tag" #{itemprop} href="#{path}?tags=#{u(tag)}">#{h(humanized_tag)}</a> }
|
||||
|
||||
unless options[:name_only]
|
||||
if counts[tag].to_i >= 10_000
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<% if post.visible? %>
|
||||
<%= image_tag(post.file_url_for(CurrentUser.user), :width => post.image_width_for(CurrentUser.user), :height => post.image_height_for(CurrentUser.user), :id => "image", "data-original-width" => post.image_width, "data-original-height" => post.image_height, "data-large-width" => post.large_image_width, "data-large-height" => post.large_image_height, "data-tags" => post.tag_string, "data-uploader" => post.uploader_name, "data-rating" => post.rating, "data-flags" => post.status_flags, "data-parent-id" => post.parent_id, "data-has-children" => post.has_children?, "data-has-active-children" => post.has_active_children?, "data-score" => post.score, "data-fav-count" => post.fav_count) %>
|
||||
<%= image_tag(post.file_url_for(CurrentUser.user), :width => post.image_width_for(CurrentUser.user), :height => post.image_height_for(CurrentUser.user), :id => "image", "data-original-width" => post.image_width, "data-original-height" => post.image_height, "data-large-width" => post.large_image_width, "data-large-height" => post.large_image_height, "data-tags" => post.tag_string, "data-uploader" => post.uploader_name, "data-rating" => post.rating, "data-flags" => post.status_flags, "data-parent-id" => post.parent_id, "data-has-children" => post.has_children?, "data-has-active-children" => post.has_active_children?, "data-score" => post.score, "data-fav-count" => post.fav_count, "itemprop" => "contentUrl") %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
<ul>
|
||||
<ul itemscope itemtype="http://schema.org">
|
||||
<li>ID: <%= post.id %></li>
|
||||
<li>Uploader: <%= link_to_user(post.uploader) + " ".html_safe + link_to("»".html_safe, posts_path(:tags => "user:#{post.uploader.name}"), :rel => "nofollow") %></li>
|
||||
<li>Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(:tags => "date:#{post.created_at.to_date}"), :rel => "nofollow" %></li>
|
||||
<li>
|
||||
Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(:tags => "date:#{post.created_at.to_date}"), :rel => "nofollow" %>
|
||||
<meta itemprop="uploadDate" content="<%= post.created_at.iso8601 %>">
|
||||
</li>
|
||||
<% if post.approver %>
|
||||
<li>Approver: <%= link_to_user(post.approver) %></li>
|
||||
<% end %>
|
||||
<li>
|
||||
Size: <%= link_to_if post.visible?, number_to_human_size(post.file_size), post.file_url %>
|
||||
Size: <%= link_to_if post.visible?, number_to_human_size(post.file_size), post.file_url, :itemprop => "contentSize" %>
|
||||
<% if post.has_dimensions? %>
|
||||
(<%= post.image_width %>x<%= post.image_height %>)
|
||||
(<span itemprop="width"><%= post.image_width %></span>x<span itemprop="height"><%= post.image_height %></span>)
|
||||
<% end %>
|
||||
</li>
|
||||
<li>Source: <%= post_source_tag(post) %></li>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
<%= render "posts/partials/show/notices", :post => @post %>
|
||||
|
||||
<section id="image-container" <%= PostPresenter.data_attributes(@post) %>>
|
||||
<section itemscope itemtype="http://schema.org/ImageObject" id="image-container" <%= PostPresenter.data_attributes(@post) %>>
|
||||
<div id="note-container"></div>
|
||||
<div id="note-preview"></div>
|
||||
<%= @post.presenter.image_html(self) %>
|
||||
|
||||
@@ -12,7 +12,6 @@ Disallow: /counts
|
||||
Disallow: /delayed_jobs
|
||||
Disallow: /dmails
|
||||
Disallow: /favorite
|
||||
Disallow: /favorites
|
||||
Disallow: /iqdb_queries
|
||||
Disallow: /ip_bans
|
||||
Disallow: /janitor_trials
|
||||
@@ -33,7 +32,6 @@ Disallow: /post_sets
|
||||
Disallow: /post_versions
|
||||
Disallow: /post_votes
|
||||
Disallow: /posts.atom
|
||||
Disallow: /posts/show_seq
|
||||
Disallow: /posts/random
|
||||
Disallow: /posts/copy_notes
|
||||
Disallow: /posts/revert
|
||||
|
||||
Reference in New Issue
Block a user