Do not require meta_keywords to be set (#10721)
* Remove extra character from meta_keywords in /listings/index.html.erb * Remove meta_keywords from MANDATORY_CONFIGS * Add and use meta_keywords_tag helper * Use modern tag syntax instead of deprecated syntax * Add and use meta_keywords_default helper * Add and use meta_keywords_article helper * Remove * from meta_keywords_field.label * Update meta_keyword specs to account for no keywords being set
This commit is contained in:
parent
393f2d09af
commit
c4efee10bf
34 changed files with 148 additions and 98 deletions
|
|
@ -14,8 +14,6 @@ module VerifySetupCompleted
|
|||
mascot_user_id
|
||||
mascot_image_url
|
||||
|
||||
meta_keywords
|
||||
|
||||
suggested_tags
|
||||
suggested_users
|
||||
].freeze
|
||||
|
|
|
|||
|
|
@ -216,6 +216,30 @@ module ApplicationHelper
|
|||
SiteConfig.community_member_label.pluralize
|
||||
end
|
||||
|
||||
def meta_keywords_default
|
||||
return if SiteConfig.meta_keywords[:default].blank?
|
||||
|
||||
tag.meta name: "keywords", content: SiteConfig.meta_keywords[:default]
|
||||
end
|
||||
|
||||
def meta_keywords_article(article_tags = nil)
|
||||
return if SiteConfig.meta_keywords[:article].blank?
|
||||
|
||||
content = if article_tags.present?
|
||||
"#{article_tags}, #{SiteConfig.meta_keywords[:article]}"
|
||||
else
|
||||
SiteConfig.meta_keywords[:article]
|
||||
end
|
||||
|
||||
tag.meta name: "keywords", content: content
|
||||
end
|
||||
|
||||
def meta_keywords_tag(tag_name)
|
||||
return if SiteConfig.meta_keywords[:tag].blank?
|
||||
|
||||
tag.meta name: "keywords", content: "#{SiteConfig.meta_keywords[:tag]}, #{tag_name}"
|
||||
end
|
||||
|
||||
def app_url(uri = nil)
|
||||
URL.url(uri)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@
|
|||
<%= f.fields_for :meta_keywords do |meta_keywords_field| %>
|
||||
<% SiteConfig.meta_keywords.each do |area, keywords| %>
|
||||
<div>
|
||||
<%= meta_keywords_field.label "#{area}*" %>
|
||||
<%= meta_keywords_field.label area.to_s %>
|
||||
<%= meta_keywords_field.text_field area,
|
||||
class: "form-control",
|
||||
value: SiteConfig.meta_keywords[area],
|
||||
|
|
@ -814,12 +814,12 @@
|
|||
</div>
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
header: "Rate limits and anti-spam",
|
||||
state: "collapse",
|
||||
target: "rateLimitsBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
locals: {
|
||||
header: "Rate limits and anti-spam",
|
||||
state: "collapse",
|
||||
target: "rateLimitsBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
<div id="rateLimitsBodyContainer" class="card-body collapse hide" aria-labelledby="rateLimitsBodyContainer">
|
||||
<% configurable_rate_limits.each do |key, field_hash| %>
|
||||
<div class="form-group">
|
||||
|
|
@ -835,28 +835,28 @@
|
|||
<div class="form-group">
|
||||
<%= admin_config_label :spam_trigger_terms %>
|
||||
<%= f.text_field :spam_trigger_terms,
|
||||
class: "form-control",
|
||||
value: SiteConfig.spam_trigger_terms.join(","),
|
||||
placeholder: Constants::SiteConfig::DETAILS[:spam_trigger_terms][:placeholder] %>
|
||||
class: "form-control",
|
||||
value: SiteConfig.spam_trigger_terms.join(","),
|
||||
placeholder: Constants::SiteConfig::DETAILS[:spam_trigger_terms][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:spam_trigger_terms][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
header: "Social Media",
|
||||
state: "collapse",
|
||||
target: "socialMediaBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
locals: {
|
||||
header: "Social Media",
|
||||
state: "collapse",
|
||||
target: "socialMediaBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
<div id="socialMediaBodyContainer" class="card-body collapse hide" aria-labelledby="socialMediaBodyContainer">
|
||||
<div class="form-group">
|
||||
<%= admin_config_label :twitter_hashtag %>
|
||||
<%= f.text_field :twitter_hashtag,
|
||||
class: "form-control",
|
||||
value: SiteConfig.twitter_hashtag.to_s,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:twitter_hashtag][:placeholder] %>
|
||||
class: "form-control",
|
||||
value: SiteConfig.twitter_hashtag.to_s,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:twitter_hashtag][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:twitter_hashtag][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
@ -878,38 +878,38 @@
|
|||
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
header: "Sponsors",
|
||||
state: "collapse",
|
||||
target: "sponsorsContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
locals: {
|
||||
header: "Sponsors",
|
||||
state: "collapse",
|
||||
target: "sponsorsContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
<div id="sponsorsContainer" class="card-body collapse hide" aria-labelledby="sponsorsContainer">
|
||||
<div class="form-group">
|
||||
<%= f.label :sponsor_headline %>
|
||||
<%= f.text_field :sponsor_headline,
|
||||
class: "form-control",
|
||||
value: SiteConfig.sponsor_headline,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:sponsor_headline][:placeholder] %>
|
||||
class: "form-control",
|
||||
value: SiteConfig.sponsor_headline,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:sponsor_headline][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:sponsor_headline][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
header: "Tags",
|
||||
state: "collapse",
|
||||
target: "tagsBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
locals: {
|
||||
header: "Tags",
|
||||
state: "collapse",
|
||||
target: "tagsBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
<div id="tagsBodyContainer" class="card-body collapse hide" aria-labelledby="tagsBodyContainer">
|
||||
<div class="form-group">
|
||||
<%= admin_config_label :sidebar_tags %>
|
||||
<%= f.text_field :sidebar_tags,
|
||||
class: "form-control",
|
||||
value: SiteConfig.sidebar_tags.join(","),
|
||||
placeholder: Constants::SiteConfig::DETAILS[:sidebar_tags][:placeholder] %>
|
||||
class: "form-control",
|
||||
value: SiteConfig.sidebar_tags.join(","),
|
||||
placeholder: Constants::SiteConfig::DETAILS[:sidebar_tags][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:sidebar_tags][:description] %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -917,47 +917,47 @@
|
|||
|
||||
<div class="card mt-3">
|
||||
<%= render partial: "card_header",
|
||||
locals: {
|
||||
header: "User Experience and Brand",
|
||||
state: "collapse",
|
||||
target: "uxBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
locals: {
|
||||
header: "User Experience and Brand",
|
||||
state: "collapse",
|
||||
target: "uxBodyContainer",
|
||||
expanded: "false"
|
||||
} %>
|
||||
<div id="uxBodyContainer" class="card-body collapse hide" aria-labelledby="uxBodyContainer">
|
||||
<div class="form-group">
|
||||
<%= f.label :feed_style %>
|
||||
<%= f.text_field :feed_style,
|
||||
class: "form-control",
|
||||
value: SiteConfig.feed_style,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:feed_style][:placeholder] %>
|
||||
class: "form-control",
|
||||
value: SiteConfig.feed_style,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:feed_style][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:feed_style][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :feed_strategy %>
|
||||
<%= f.text_field :feed_strategy,
|
||||
class: "form-control",
|
||||
value: SiteConfig.feed_strategy,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:feed_strategy][:placeholder] %>
|
||||
class: "form-control",
|
||||
value: SiteConfig.feed_strategy,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:feed_strategy][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:feed_strategy][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :default_font %>
|
||||
<%= select_tag "site_config[default_font]",
|
||||
options_for_select(
|
||||
[%w[sans-serif sans_serif], %w[serif serif], %w[open-dyslexic open_dyslexic]],
|
||||
SiteConfig.default_font,
|
||||
),
|
||||
multiple: false,
|
||||
class: "form-control selectpicker" %>
|
||||
options_for_select(
|
||||
[%w[sans-serif sans_serif], %w[serif serif], %w[open-dyslexic open_dyslexic]],
|
||||
SiteConfig.default_font,
|
||||
),
|
||||
multiple: false,
|
||||
class: "form-control selectpicker" %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:default_font][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.label :primary_brand_color_hex %>
|
||||
<%= f.text_field :primary_brand_color_hex,
|
||||
class: "form-control",
|
||||
value: SiteConfig.primary_brand_color_hex,
|
||||
pattern: "^#+([a-fA-F0-9]{6})$",
|
||||
placeholder: Constants::SiteConfig::DETAILS[:primary_brand_color_hex][:placeholder] %>
|
||||
class: "form-control",
|
||||
value: SiteConfig.primary_brand_color_hex,
|
||||
pattern: "^#+([a-fA-F0-9]{6})$",
|
||||
placeholder: Constants::SiteConfig::DETAILS[:primary_brand_color_hex][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:primary_brand_color_hex][:description] %></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<link rel="canonical" href="<%= app_url(request.path) %>" />
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= app_url(request.path) %>" />
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<% title "Search Results" %>
|
||||
<link rel="canonical" href="<%= app_url(search_path) %>" />
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= community_name %> => Search Results" />
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@
|
|||
<% if internal_navigation? %>
|
||||
<link rel="canonical" href="<%= @article.canonical_url.presence || app_url(@article.path) %>" />
|
||||
<meta name="description" content="<%= @article.description_and_tags %>">
|
||||
<meta name="keywords" content="<%= @article.cached_tag_list %>, <%= SiteConfig.meta_keywords[:article] %>">
|
||||
<%= meta_keywords_article(@article.cached_tag_list) %>
|
||||
<% else %>
|
||||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= @article.canonical_url.presence || app_url(@article.path) %>" />
|
||||
<meta name="description" content="<%= @article.description_and_tags %>">
|
||||
<meta name="keywords" content="<%= @article.cached_tag_list %>, <%= SiteConfig.meta_keywords[:article] %>">
|
||||
<%= meta_keywords_article(@article.cached_tag_list) %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= article_url(@article) %>" />
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<link rel="canonical" href="<%= tag_url(@tag_model, @page) %>" />
|
||||
<meta name="description" content="<%= @tag %> content on <%= community_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:tag] %>, <%= @tag %>">
|
||||
<%= meta_keywords_tag(@tag) %>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= tag_url(@tag_model, @page) %>" />
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<% title title_string %>
|
||||
<link rel="canonical" href="<%= app_url("/about") %>" />
|
||||
<meta name="description" content="<%= title_string %> on <%= community_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/about") %>" />
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<%= content_for :page_meta do %>
|
||||
<meta name="description" content="<%= @commentable.description || "An article from the community" %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:article] %>">
|
||||
<%= meta_keywords_article %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:title" content="Discussion of <%= @commentable.title %>" />
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
<% title("#{community_name} EVENTS") %>
|
||||
<link rel="canonical" href="<%= app_url("/events") %>" />
|
||||
<meta name="description" content="<%= community_name %> Events">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/events") %>" />
|
||||
<meta property="og:title" content="<%= community_name %> Events" />
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% title("#{@event.title} - #{community_name}") %>
|
||||
<link rel="canonical" href="<%= app_url("/#{@event.slug}") %>" />
|
||||
<meta name="description" content="<%= community_name %> | Events">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/#{@event.slug}") %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
<link rel="canonical" href="<%= app_url(request.path) %>" />
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>y">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= app_url(request.path) %>" />
|
||||
<meta property="og:site_name" content="<%= community_qualified_name %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/notifications") %>" />
|
||||
<meta name="description" content="Notifications inbox for <%= community_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/notifications") %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/p/badges") %>" />
|
||||
<meta name="description" content="Add the <%= community_name %> Badge to your personal site">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/p/badges") %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url(code_of_conduct_path) %>" />
|
||||
<meta name="description" content="<%= community_qualified_name %> Code of Conduct">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url(code_of_conduct_path) %>" />
|
||||
<meta property="og:title" content="<%= community_qualified_name %> Code of Conduct" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/contact") %>" />
|
||||
<meta name="description" content="Contact #{community_qualified_name}">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/contact") %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/p/editor_guide") %>" />
|
||||
<meta name="description" content="<%= community_name %> | editor guideline">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
<% end %>
|
||||
|
||||
<div class="blank-space"></div>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/p/information") %>" />
|
||||
<meta name="description" content="All information about <%= community_qualified_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/p/information") %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/p/markdown_basics") %>" />
|
||||
<meta name="description" content="dev.to | markdown basics">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
<% end %>
|
||||
|
||||
<div class="crayons-layout crayons-layout--limited">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/privacy") %>" />
|
||||
<meta name="description" content="Privacy Policy for <%= community_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/privacy") %>" />
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/p/publishing_from_rss_guide") %>" />
|
||||
<meta name="description" content="dev.to | publishing from rss guideline">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
|
||||
<%= meta_keywords_default %>
|
||||
<% end %>
|
||||
|
||||
<header>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/report-abuse") %>" />
|
||||
<meta name="description" content="Report Abuse">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/report-abuse") %>" />
|
||||
<meta property="og:title" content="Report Abuse" />
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url(@page.path) %>" />
|
||||
<meta name="description" content="<%= @page.title %> — <%= community_qualified_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url(@page.path) %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/sponsors") %>" />
|
||||
<meta name="description" content="<%= community_name %> | Sponsors">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
<% end %>
|
||||
|
||||
<div class="crayons-layout crayons-layout--limited">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/terms") %>" />
|
||||
<meta name="description" content="Terms of Use for the <%= community_qualified_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/terms") %>" />
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url(@podcast.slug) %>" />
|
||||
<meta name="description" content="<%= @podcast.description %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url(@podcast.slug) %>" />
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url(pod_path) %>" />
|
||||
<meta name="description" content="Discover technical podcasts for <%= community_members_label %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url(pod_path) %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/#{@podcast.slug}/#{@episode.slug}") %>" />
|
||||
<meta name="description" content="<%= truncate(strip_tags(@episode.body), length: 140) %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/#{@podcast.slug}/#{@episode.slug}") %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/readinglist") %>" />
|
||||
<meta name="description" content="My saved posts.">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/readinglist") %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url("/about") %>" />
|
||||
<meta name="description" content="Tags to follow on <%= community_name %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="<%= app_url("/about") %>" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<link rel="canonical" href="<%= user_url(@user) %>" />
|
||||
<meta name="description" content="<%= @user.summary %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= user_url(@user) %>" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="<%= app_url(request.path) %>" />
|
||||
<meta name="description" content="<%= SiteConfig.community_description %>">
|
||||
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">
|
||||
<%= meta_keywords_default %>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= app_url(request.path) %>" />
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ RSpec.describe "ArticlesShow", type: :request do
|
|||
end
|
||||
# rubocop:enable RSpec/ExampleLength
|
||||
|
||||
context "when keywords are set up" do
|
||||
context "when keywords are set" do
|
||||
it "shows keywords" do
|
||||
SiteConfig.meta_keywords = { article: "hello, world" }
|
||||
article.update_column(:cached_tag_list, "super sheep")
|
||||
|
|
@ -87,6 +87,17 @@ RSpec.describe "ArticlesShow", type: :request do
|
|||
end
|
||||
end
|
||||
|
||||
context "when keywords are not" do
|
||||
it "does not show keywords" do
|
||||
SiteConfig.meta_keywords = { article: "" }
|
||||
article.update_column(:cached_tag_list, "super sheep")
|
||||
get article.path
|
||||
expect(response.body).not_to include(
|
||||
'<meta name="keywords" content="super sheep, hello, world">',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context "when user signed in" do
|
||||
before do
|
||||
sign_in user
|
||||
|
|
|
|||
|
|
@ -119,12 +119,20 @@ RSpec.describe "StoriesIndex", type: :request do
|
|||
expect(response.headers["X-Accel-Expires"]).to eq("600")
|
||||
end
|
||||
|
||||
it "shows default meta keywords" do
|
||||
it "shows default meta keywords if set" do
|
||||
SiteConfig.meta_keywords = { default: "cool developers, civil engineers" }
|
||||
get "/"
|
||||
expect(response.body).to include("<meta name=\"keywords\" content=\"cool developers, civil engineers\">")
|
||||
end
|
||||
|
||||
it "does not show default meta keywords if not set" do
|
||||
SiteConfig.meta_keywords = { default: "" }
|
||||
get "/"
|
||||
expect(response.body).not_to include(
|
||||
"<meta name=\"keywords\" content=\"cool developers, civil engineers\">",
|
||||
)
|
||||
end
|
||||
|
||||
it "shows only one cover if basic feed style" do
|
||||
create_list(:article, 3, featured: true, score: 20, main_image: "https://example.com/image.jpg")
|
||||
|
||||
|
|
@ -348,12 +356,20 @@ RSpec.describe "StoriesIndex", type: :request do
|
|||
expect(response.body).to include(sponsorship.blurb_html)
|
||||
end
|
||||
|
||||
it "shows meta keywords" do
|
||||
it "shows meta keywords if set" do
|
||||
SiteConfig.meta_keywords = { tag: "software engineering, ruby" }
|
||||
get "/t/#{tag.name}"
|
||||
expect(response.body).to include("<meta name=\"keywords\" content=\"software engineering, ruby, #{tag.name}\">")
|
||||
end
|
||||
|
||||
it "does not show meta keywords if not set" do
|
||||
SiteConfig.meta_keywords = { tag: "" }
|
||||
get "/t/#{tag.name}"
|
||||
expect(response.body).not_to include(
|
||||
"<meta name=\"keywords\" content=\"software engineering, ruby, #{tag.name}\">",
|
||||
)
|
||||
end
|
||||
|
||||
context "with user signed in" do
|
||||
before do
|
||||
sign_in user
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@ RSpec.describe "Admin manages configuration", type: :system do
|
|||
visit admin_config_path
|
||||
end
|
||||
|
||||
# Note: The :meta_keywords are handled slightly differently in the view, so we
|
||||
# can't check them the same way as the rest.
|
||||
(VerifySetupCompleted::MANDATORY_CONFIGS - [:meta_keywords]).each do |option|
|
||||
VerifySetupCompleted::MANDATORY_CONFIGS.each do |option|
|
||||
it "marks #{option} as required" do
|
||||
selector = "label[for='site_config_#{option}']"
|
||||
expect(first(selector).text).to include("Required")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue