An error occurred while processing the template.
The following has evaluated to null or missing:
==> dynamicElement.element("dynamic-content") [in template "17616084546371#20119#264371" at line 210, column 42]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign imageJSONString = dynamicElem... [in template "17616084546371#20119#264371" at line 210, column 15]
----
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Most Visited News</title>
7
8 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9 <style>
10
11 :root {
12 --primary-color: #1187ec;
13 --secondary-color: #1187ec;
14 --accent-color: #1187ec;
15 --text-color: #000;
16 --light-bg: #1187ec;
17 }
18 .most-visited-container {
19 max-width: 1400px;
20 margin: 0 auto;
21 padding: 2rem 1rem;
22 }
23
24 .section-header {
25 display: flex;
26 justify-content: space-between;
27 align-items: center;
28 margin-bottom: 2rem;
29 border-bottom: 3px solid var(--secondary-color);
30 padding-bottom: 0.5rem;
31 }
32
33 .section-title {
34 font-size: 1.5rem;
35 font-weight: 700;
36 color: var(--primary-color);
37 margin: 0;
38 }
39
40 .view-all {
41 color: var(--accent-color);
42 font-weight: 600;
43 text-decoration: none;
44 transition: all 0.3s ease;
45 }
46
47 .view-all:hover {
48 color: var(--secondary-color);
49 text-decoration: underline;
50 }
51
52 .most-visited-grid {
53 display: grid;
54 grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
55 gap: 2rem;
56 }
57
58 .visited-card {
59 background: white;
60 border-radius: 10px;
61 overflow: hidden;
62 box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
63 transition: all 0.3s ease;
64 display: flex;
65 flex-direction: column;
66 height: 100%;
67 }
68
69 .visited-card:hover {
70 transform: translateY(-5px);
71 box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
72 }
73
74 .card-badge {
75 position: absolute;
76 top: 15px;
77 left: 15px;
78 background: var(--secondary-color);
79 color: white;
80 padding: 0.25rem 0.75rem;
81 border-radius: 20px;
82 font-size: 0.8rem;
83 font-weight: 600;
84 z-index: 2;
85 }
86
87 .card-img-container {
88 position: relative;
89 height: 200px;
90 overflow: hidden;
91 }
92
93 .card-img {
94 width: 100%;
95 height: 100%;
96 object-fit: cover;
97 transition: transform 0.5s ease;
98 }
99
100 .visited-card:hover .card-img {
101 transform: scale(1.05);
102 }
103
104 .card-body {
105 padding: 1.5rem;
106 display: flex;
107 flex-direction: column;
108 flex-grow: 1;
109 }
110
111 .card-title {
112 font-size: 1.25rem;
113 font-weight: 700;
114 margin-bottom: 0.75rem;
115 line-height: 1.4;
116 color: var(--primary-color);
117 }
118
119 .card-title a {
120 color: inherit;
121 text-decoration: none;
122 transition: color 0.3s ease;
123 }
124
125 .card-title a:hover {
126 color: var(--accent-color);
127 }
128
129 .card-excerpt {
130 color: var(--text-color);
131 margin-bottom: 1rem;
132 line-height: 1.6;
133 flex-grow: 1;
134 }
135
136 .card-meta {
137 display: flex;
138 justify-content: space-between;
139 align-items: center;
140 margin-top: auto;
141 font-size: 0.85rem;
142 color: #666;
143 }
144
145 .views-count {
146 display: flex;
147 align-items: center;
148 gap: 0.25rem;
149 color: var(--secondary-color);
150 font-weight: 600;
151 }
152
153 .publish-date {
154 display: flex;
155 align-items: center;
156 gap: 0.25rem;
157 }
158
159 .read-more {
160 align-self: flex-start;
161 margin-top: 1rem;
162 padding: 0.5rem 1.25rem;
163 color: white;
164 border: none;
165 border-radius: 5px;
166 font-weight: 600;
167 transition: all 0.3s ease;
168 text-decoration: none;
169 }
170
171 .read-more:hover {
172 background: var(--primary-color);
173 color: white;
174 }
175
176 @media (max-width: 768px) {
177 .most-visited-grid {
178 grid-template-columns: 1fr;
179 }
180
181 .section-title {
182 font-size: 1.5rem;
183 }
184 }
185 </style>
186</head>
187<body>
188 <div class="most-visited-container">
189 <div class="section-header">
190 <h4 class="section-title">Latest News</h4>
191
192 </div>
193
194 <div class="most-visited-grid">
195 <#if entries?has_content>
196 <#list entries as curEntry>
197 <#assign
198 assetRenderer = curEntry.getAssetRenderer()
199 item = assetRenderer.getArticle()
200 imageUrl = ""
201 content = ""
202 publishDate = curEntry.getPublishDate()?string("MMM dd, yyyy")
203 viewCount = curEntry.getViewCount()!"N/A"
204 isPopular = curEntry?index < 3
205 >
206
207 <#-- Extract image and content from dynamic elements -->
208 <#list item.document.rootElement.elements() as dynamicElement>
209 <#if dynamicElement.attributeValue("field-reference") == "image">
210 <#assign imageJSONString = dynamicElement.element("dynamic-content").getText()!"" />
211 <#if imageJSONString?has_content>
212 <#attempt>
213 <#assign imageUrl = jsonFactoryUtil.createJSONObject(imageJSONString).getString("url")!"" />
214 <#recover>
215 </#attempt>
216 </#if>
217 <#elseif dynamicElement.attributeValue("field-reference") == "content">
218 <#assign content = dynamicElement.element("dynamic-content").getText()!"" />
219 </#if>
220 </#list>
221
222 <#if imageUrl?has_content>
223 <div class="visited-card">
224
225
226 <div class="card-img-container">
227 <img src="${imageUrl}" class="card-img" alt="${curEntry.getTitle(locale)?html}">
228 </div>
229
230 <div class="card-body">
231 <h3 class="card-title">
232 <a href="/web/eng/w/${item.urlTitle}">${curEntry.getTitle(locale)}</a>
233 </h3>
234
235 <#if content?has_content>
236 <p class="card-excerpt">
237 ${content?replace("<[^>]*>", "", "r")?truncate(150, "...")}
238 </p>
239 </#if>
240
241 <div class="card-meta">
242 <span class="publish-date">
243 <i class="far fa-calendar-alt"></i> ${publishDate}
244 </span>
245 <span class="views-count">
246 <a href="/web/eng/w/${item.urlTitle}" class="read-more">Read More</a>
247 </span>
248 </div>
249 </div>
250 </div>
251 </#if>
252 </#list>
253 <#else>
254 <div class="alert alert-info w-100">No popular articles found.</div>
255 </#if>
256 </div>
257 </div>
258</body>
259</html>
An error occurred while processing the template.
The following has evaluated to null or missing:
==> dynamicElement.element("dynamic-content") [in template "17616084546371#20119#264411" at line 107, column 32]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign imageJSON = dynamicElement.el... [in template "17616084546371#20119#264411" at line 107, column 11]
----
1<!DOCTYPE html>
2<html lang="am">
3<head>
4 <meta charset="UTF-8">
5 <title>News Card List</title>
6
7 <style>
8 body {
9 font-family: 'Noto Sans Ethiopic', sans-serif;
10 background-color: #f8f9fa;
11 }
12
13 .news-list {
14 max-width: 700px;
15 margin: 30px auto;
16 }
17
18 .news-card {
19 display: flex;
20 align-items: center;
21 background: #fff;
22 border-radius: 15px;
23 box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
24 margin-bottom: 20px;
25 overflow: hidden;
26 transition: all 0.2s ease-in-out;
27 }
28
29 .news-card:hover {
30 transform: scale(1.01);
31 }
32
33 .news-card img {
34 width: 120px;
35 height: 100px;
36 object-fit: cover;
37 flex-shrink: 0;
38 }
39
40 .news-details {
41 padding: 12px 16px;
42 flex: 1;
43 }
44
45 .news-title {
46 font-size: 14px;
47 font-weight: bold;
48 color: #1a202c;
49 margin-bottom: 5px;
50 display: block;
51 text-decoration: none;
52 line-height: 1.4;
53 }
54
55 .news-title:hover {
56 color: #0d6efd;
57 }
58
59 .news-date {
60 font-size: 13px;
61 color: #6c757d;
62 margin-bottom: 8px;
63 }
64
65 .read-more {
66 font-size: 13px;
67 color: #0d6efd;
68 text-decoration: none;
69 font-weight: 500;
70 }
71
72 .read-more:hover {
73 text-decoration: underline;
74 }
75
76 @media (max-width: 576px) {
77 .news-card {
78 flex-direction: column;
79 align-items: flex-start;
80 }
81
82 .news-card img {
83 width: 100%;
84 height: auto;
85 }
86
87 .news-details {
88 padding: 10px;
89 }
90 }
91 </style>
92</head>
93<body>
94
95<div class="news-list">
96 <#if entries?has_content>
97 <#list entries as curEntry>
98 <#assign assetRenderer = curEntry.getAssetRenderer()
99 item = assetRenderer.getArticle()
100 title = curEntry.getTitle(locale)
101 date = curEntry.getPublishDate()?string("MMM dd, yyyy")
102 imageUrl = ""
103 articleUrl = "/web/eng/w/${item.urlTitle}" />
104
105 <#list item.document.rootElement.elements() as dynamicElement>
106 <#if dynamicElement.attributeValue("field-reference") == "image">
107 <#assign imageJSON = dynamicElement.element("dynamic-content").getText() />
108 <#attempt>
109 <#assign imageUrl = jsonFactoryUtil.createJSONObject(imageJSON).getString("url") />
110 <#recover>
111 <#assign imageUrl = "" />
112 </#attempt>
113 </#if>
114 </#list>
115
116 <#if imageUrl?has_content>
117 <div class="news-card">
118 <a href="${articleUrl}">
119 <img src="${imageUrl}" alt="News Thumbnail">
120 </a>
121 <div class="news-details">
122 <a href="${articleUrl}" class="news-title">${title}</a>
123 <div class="news-date">${date}</div>
124 <a href="${articleUrl}" class="read-more">Read More →</a>
125 </div>
126 </div>
127 </#if>
128 </#list>
129 </#if>
130</div>
131
132</body>
133</html>