An error occurred while processing the template.
The following has evaluated to null or missing:
==> dynamicElement.element("dynamic-content") [in template "17616084546371#20119#196824" 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#196824" 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">ወቅታዊ ዜናዎች</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/guest/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
242
243 <div class="card-meta">
244 <span class="publish-date">
245 <i class="far fa-calendar-alt"></i> ${publishDate}
246 </span>
247 <span class="views-count">
248 <a href="/web/guest/w/${item.urlTitle}" class="read-more">ተጨማሪ ያንብቡ</a>
249 </span>
250 </div>
251 </div>
252 </div>
253 </#if>
254 </#list>
255 <#else>
256 <div class="alert alert-info w-100">No popular articles found.</div>
257 </#if>
258 </div>
259 </div>
260</body>
261</html>