diff --git a/app/components/page/card_section_component.html.erb b/app/components/page/card_section_component.html.erb
index 32084e46..4417bd81 100644
--- a/app/components/page/card_section_component.html.erb
+++ b/app/components/page/card_section_component.html.erb
@@ -1,6 +1,10 @@
<% if @title %>
- <%= @title %>
+ <% if @all_url %>
+ <%= link_to @title, @all_url %>
+ <% else %>
+ <%= @title %>
+ <% end %>
<% end %>
@@ -12,6 +16,12 @@
<% if @all_url %>
<%= link_to @all_url do %>
- View all ->
+ View all
+
+ <% if @total && @total > @count %>
+ (<%= @total - @count %> more)
+ <% end %>
+
+ ->
<% end %>
<% end %>
diff --git a/app/components/page/card_section_component.rb b/app/components/page/card_section_component.rb
index 9b07e456..faf66a6f 100644
--- a/app/components/page/card_section_component.rb
+++ b/app/components/page/card_section_component.rb
@@ -1,9 +1,14 @@
# frozen_string_literal: true
class Page::CardSectionComponent < ViewComponent::Base
- def initialize(resources:, title: nil, all_url: nil)
+ def initialize(resources:, title: nil, all_url: nil, count: nil)
@title = title
- @resources = resources
+ @count = count
@all_url = all_url
+
+ resources = Array.wrap(resources)
+
+ @resources = @count ? resources.take(@count) : resources
+ @total = resources.count
end
end
diff --git a/app/content/pages/ecosystem.html.erb b/app/content/pages/ecosystem.html.erb
index 132ddea9..67d8e6f1 100644
--- a/app/content/pages/ecosystem.html.erb
+++ b/app/content/pages/ecosystem.html.erb
@@ -6,9 +6,12 @@ title: Ecosystem
<% page.with_title(title: current_page.data.fetch("title")) %>
<% EcosystemModel.all.sort_by(&:order).each do |page| %>
+ <% subpages = site.resources.glob("#{page.page.request_path}/*.html.erb".delete_prefix("/")).sort_by { |site| site.data.fetch("title") } %>
+
<%= render Page::CardSectionComponent.new(
title: page.title,
- resources: site.resources.glob("#{page.page.request_path}/*.html.erb".delete_prefix("/")).sort_by { |site| site.data.fetch("title") }.take(3),
+ resources: subpages,
+ count: 6,
all_url: page.request_path
) %>
<% end %>