views: update seo title and description of post index page.

Change the title of the post index page to look like this:

    "Danbooru: Anime Image Board" (for the front page)
    "Kantai Collection Art | Danbooru" (for a tag search)

Change the meta description of the front page to look like this:

    Danbooru is the original anime image 'booru. Find over 3.75 million
    anime pictures categorized by over 100 million tags.

Change the meta description for a tag search to look like this:

    Find over 37,168 Azur Lane images on Danbooru. Azur Lane (碧蓝航线)
    (벽람항로) is a Chinese shipgirl-themed side-scrolling shoot 'em up
    mobile game developed by Shanghai Manjuu and Xiamen Yongshi...
This commit is contained in:
evazion
2020-01-25 03:22:54 -06:00
parent 9f40d31748
commit fb9b2bb014
9 changed files with 39 additions and 47 deletions

View File

@@ -269,26 +269,34 @@ module ApplicationHelper
end.to_h
end
def page_title(title = nil)
def page_title(title = nil, suffix: "| #{Danbooru.config.app_name}")
if title.present?
content_for(:page_title) { "#{title} | #{Danbooru.config.app_name}" }
content_for(:page_title) { "#{title} #{suffix}".strip }
elsif content_for(:page_title).present?
content_for(:page_title)
elsif params[:action] == "index"
"#{params[:controller].titleize} | #{Danbooru.config.app_name}"
"#{params[:controller].titleize} #{suffix}"
elsif params[:action] == "show"
"#{params[:controller].singularize.titleize} | #{Danbooru.config.app_name}"
"#{params[:controller].singularize.titleize} #{suffix}"
elsif params[:action] == "new"
"New #{params[:controller].singularize.titleize} | #{Danbooru.config.app_name}"
"New #{params[:controller].singularize.titleize} #{suffix}"
elsif params[:action] == "edit"
"Edit #{params[:controller].singularize.titleize} | #{Danbooru.config.app_name}"
"Edit #{params[:controller].singularize.titleize} #{suffix}"
elsif params[:action] == "search"
"Search #{params[:controller].titleize} | #{Danbooru.config.app_name}"
"Search #{params[:controller].titleize} #{suffix}"
else
"#{Danbooru.config.app_name}/#{params[:controller]}"
end
end
def meta_description(description = nil)
if description.present?
content_for(:meta_description) { description }
elsif content_for(:meta_description).present?
content_for(:meta_description)
end
end
def show_moderation_notice?
CurrentUser.can_approve_posts? && (cookies[:moderated].blank? || Time.at(cookies[:moderated].to_i) < 72.hours.ago)
end

View File

@@ -1,7 +1,7 @@
module WikiPagesHelper
def wiki_page_excerpt(wiki_page)
text = strip_dtext(wiki_page.body).split(/\r\n|\r|\n/).first
truncate(text, length: 160)
text.truncate(160)
end
def wiki_page_other_names_list(wiki_page)