Prevent unnecessary wiki page queries for multi-tag searches

This commit is contained in:
Toks
2013-12-09 12:25:16 -05:00
parent 9f1df439a6
commit cc2443e3af
2 changed files with 3 additions and 3 deletions

View File

@@ -19,11 +19,11 @@ module PostSets
end
def has_wiki?
tag_array.size == 1 && ::WikiPage.titled(tag_string).exists?
is_single_tag? && ::WikiPage.titled(tag_string).exists?
end
def wiki_page
if tag_array.any?
if is_single_tag?
::WikiPage.titled(tag_string).first
else
nil

View File

@@ -48,7 +48,7 @@
<%= content_for(:html_header) do %>
<link href="<%= posts_path(:format => 'atom', :tags => params[:tags]) %>" rel="alternate" title="ATOM" type="application/atom+xml" />
<% if @post_set.wiki_page %>
<% if @post_set.has_wiki? %>
<meta name="description" content="<%= @post_set.wiki_page.presenter.blurb %>"></meta>
<% end %>
<% end %>