wiki_pages/show: fix <meta> description tag.
Use an excerpt of the first paragraph rather than the entire page.
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
module WikiPagesHelper
|
||||
def wiki_page_excerpt(wiki_page)
|
||||
text = strip_dtext(wiki_page.body).split(/\r\n|\r|\n/).first
|
||||
truncate(text, length: 160)
|
||||
end
|
||||
|
||||
def wiki_page_other_names_list(wiki_page)
|
||||
names_html = wiki_page.other_names.map {|name| link_to(name, "http://www.pixiv.net/search.php?s_mode=s_tag_full&word=#{u(name)}", :class => "wiki-other-name")}
|
||||
names_html.join(" ").html_safe
|
||||
|
||||
@@ -5,10 +5,6 @@ class WikiPagePresenter
|
||||
@wiki_page = wiki_page
|
||||
end
|
||||
|
||||
def excerpt
|
||||
wiki_page.body
|
||||
end
|
||||
|
||||
# Produce a formatted page that shows the difference between two versions of a page.
|
||||
def diff(other_version)
|
||||
pattern = Regexp.new('(?:<.+?>)|(?:[0-9_A-Za-z\x80-\xff]+[\x09\x20]?)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<p><%= wiki_page_other_names_list(wiki_page) %></p>
|
||||
<% end %>
|
||||
|
||||
<%= format_text(wiki_page.presenter.excerpt) %>
|
||||
<%= format_text(wiki_page.body) %>
|
||||
<%= render "tag_relationships/alias_and_implication_list", tag: wiki_page.tag %>
|
||||
|
||||
<p class="links">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<% end %>
|
||||
|
||||
<% content_for(:html_header) do %>
|
||||
<meta name="description" content="<%= strip_dtext(@wiki_page.presenter.excerpt) %>"></meta>
|
||||
<%= tag.meta name: "description", content: wiki_page_excerpt(@wiki_page) %>
|
||||
<% end %>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
Reference in New Issue
Block a user