Skip to content

Commit b4dc4fd

Browse files
authored
Add view-all link in Trending section on landing page (#8824)
1 parent 4e81474 commit b4dc4fd

File tree

1 file changed

+14
-14
lines changed
  • app/lib/frontend/templates/views/landing

1 file changed

+14
-14
lines changed

app/lib/frontend/templates/views/landing/page.dart

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ d.Node landingPageNode({
4646
title: 'Trending packages',
4747
info: d.text('Top trending packages in the last 30 days'),
4848
content: miniListNode('most-trending', trendingPackages!),
49+
viewAllUrl: urls.listingByTrending(),
4950
viewAllEvent: 'landing-trending-view-all',
5051
viewAllTitle: 'Search trending packages',
5152
)
@@ -123,12 +124,12 @@ d.Node _block({
123124
required String title,
124125
required d.Node info,
125126
required d.Node content,
126-
String? viewAllUrl,
127+
required String viewAllUrl,
127128
required String viewAllEvent,
128129
String viewAllLabel = 'View all',
129130
required String viewAllTitle,
130131
}) {
131-
final isExternalUrl = viewAllUrl != null && !viewAllUrl.startsWith('/');
132+
final isExternalUrl = !viewAllUrl.startsWith('/');
132133
return d.div(
133134
classes: ['home-block', 'home-block-$shortId'],
134135
children: [
@@ -145,19 +146,18 @@ d.Node _block({
145146
d.h1(classes: ['home-block-title'], text: title),
146147
d.p(classes: ['home-block-context-info'], child: info),
147148
content,
148-
if (viewAllUrl != null)
149-
d.div(
150-
classes: ['home-block-view-all'],
151-
child: d.a(
152-
classes: ['home-block-view-all-link'],
153-
href: viewAllUrl,
154-
target: isExternalUrl ? '_blank' : null,
155-
rel: isExternalUrl ? 'noopener nofollow' : 'nofollow',
156-
text: viewAllLabel,
157-
title: viewAllTitle,
158-
attributes: {'data-ga-click-event': viewAllEvent},
159-
),
149+
d.div(
150+
classes: ['home-block-view-all'],
151+
child: d.a(
152+
classes: ['home-block-view-all-link'],
153+
href: viewAllUrl,
154+
target: isExternalUrl ? '_blank' : null,
155+
rel: isExternalUrl ? 'noopener nofollow' : 'nofollow',
156+
text: viewAllLabel,
157+
title: viewAllTitle,
158+
attributes: {'data-ga-click-event': viewAllEvent},
160159
),
160+
),
161161
],
162162
),
163163
// image: after content

0 commit comments

Comments
 (0)