diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb index 17d38397d..8d57b2c43 100644 --- a/app/views/articles/index.html.erb +++ b/app/views/articles/index.html.erb @@ -43,7 +43,7 @@ "> - " href="<%= list_path %>/" class="crayons-navigation__item <%= "crayons-navigation__item--current" if %w[week month year infinity latest].exclude?(params[:timeframe]) %>" + " href="<%= list_path.presence || "/" %>" class="crayons-navigation__item <%= "crayons-navigation__item--current" if %w[week month year infinity latest].exclude?(params[:timeframe]) %>" <%= %w[week month year infinity latest].exclude?(params[:timeframe]) ? ' aria-current="page"'.html_safe : "" %>><%= t("views.stories.sort.relevant") %> diff --git a/app/views/stories/tagged_articles/index.html.erb b/app/views/stories/tagged_articles/index.html.erb index 055122399..6f5bc9928 100644 --- a/app/views/stories/tagged_articles/index.html.erb +++ b/app/views/stories/tagged_articles/index.html.erb @@ -61,7 +61,7 @@ "> - " href="<%= list_path %>/" class="crayons-navigation__item <%= "crayons-navigation__item--current" if %w[week month year infinity latest].exclude?(params[:timeframe]) %>" + " href="<%= list_path %>" class="crayons-navigation__item <%= "crayons-navigation__item--current" if %w[week month year infinity latest].exclude?(params[:timeframe]) %>" <%= %w[week month year infinity latest].exclude?(params[:timeframe]) ? ' aria-current="page"'.html_safe : "" %>><%= t("views.stories.sort.relevant") %> diff --git a/spec/requests/stories/tagged_articles_spec.rb b/spec/requests/stories/tagged_articles_spec.rb index 74aaae351..bad793e22 100644 --- a/spec/requests/stories/tagged_articles_spec.rb +++ b/spec/requests/stories/tagged_articles_spec.rb @@ -172,6 +172,14 @@ RSpec.describe "Stories::TaggedArticlesIndex", type: :request do get "/t/#{tag.name}" expect(response.body).not_to include('') end + + it "includes a link to Relevant", :aggregate_failures do + get "/t/#{tag.name}/latest" + + # The link should be `/t/tag2` (without a trailing slash) instead of `/t/tag2/` + expected_tag = "