+ <%# Featured Articles %>
+ <% if !@is_plain_layout_enabled %>
+
<%= render "public/api/v1/portals/featured_articles", articles: @portal.articles, categories: @portal.categories.where(locale: @locale), portal: @portal %>
+ <% end %>
+ <%# Categories with articles %>
+
<% @portal.categories.where(locale: @locale).joins(:articles).where(articles:{ status: :published }).order(position: :asc).group('categories.id').each do |category| %>
<%= render "public/api/v1/portals/category-block", category: category, portal: @portal %>
<% end %>
-
+ <%# Uncategorized articles %>
<% if @portal.articles.where(status: :published, category_id: nil).count > 0 %>
<%= render "public/api/v1/portals/uncategorized-block", category: "Uncategorized", portal: @portal %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index af26aa8f5..69c87b3e8 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -224,6 +224,7 @@ en:
system: System
light: Light
dark: Dark
+ featured_articles: Featured Articles
404:
title: Page not found
description: We couldn't find the page you were looking for.
diff --git a/spec/helpers/portal_helper_spec.rb b/spec/helpers/portal_helper_spec.rb
index 338a9260b..0f131a279 100644
--- a/spec/helpers/portal_helper_spec.rb
+++ b/spec/helpers/portal_helper_spec.rb
@@ -101,4 +101,22 @@ describe PortalHelper do
end
end
end
+
+ describe '#generate_article_link' do
+ context 'when theme is not present' do
+ it 'returns the correct link' do
+ expect(helper.generate_article_link('portal_slug', 'article_slug', nil)).to eq(
+ '/hc/portal_slug/articles/article_slug'
+ )
+ end
+ end
+
+ context 'when theme is present' do
+ it 'returns the correct link' do
+ expect(helper.generate_article_link('portal_slug', 'article_slug', 'dark')).to eq(
+ '/hc/portal_slug/articles/article_slug?theme=dark'
+ )
+ end
+ end
+ end
end