1<#assign
2 keywords= htmlUtil.escape(searchResultsPortletDisplayContext.getKeywords())
3
4 curParam = searchContainer.getCurParam()
5 currentPage = searchContainer.getCur()
6 searchTotal = searchContainer.getTotal()
7 totalItems = (searchTotal < 100)?then(searchTotal, 100)
8 pageSize = searchContainer.getDelta()
9 totalPages = ((totalItems + pageSize - 1) / pageSize)?int
10
11 iteratorURL = searchContainer.getIteratorURL()
12 urlSeparator = iteratorURL?contains('?')?then('&', '?')
13/>
14<#assign parsedDate = dateUtil.parseDate("yyyy-MM-dd", entry.getCreationDateString(), locale) />
15
16
17<#if entries?has_content>
18 <div class="mb-10">
19 <h3 class="display-md"><@liferay.language key="search-keyword-for"/> “${keywords}”</h3>
20 <p class="text-secondary-paragraph">
21 ${languageUtil.format(locale, "search-results-count", totalItems)}
22 </p>
23 </div>
24
25 <#list entries as entry>
26 <span class="badge bg-gray-50 text-dark fw-500 border py-1.5 mb-3">${entry.getModelResource()}</span>
27
28 <a href="${entry.getViewURL()}" class="dl-link link-default fs-md fw-500 d-block">${entry.getHighlightedTitle()}</a>
29 <#if entry.isContentVisible()><p class="fs-sm text-secondary-paragraph mt-3">${entry.getContent()}</p></#if>
30 <#if entry.isCreationDateVisible()><p class="fs-sm text-secondary-paragraph mt-3">${parsedDate}</p></#if>
31
32 <hr class="my-6 border-secondary">
33 </#list>
34 <#else>
35 <h5 class="text-primary-paragraph text-center my-14"><@liferay.language key="no-results-found" /></h5>
36</#if>
37
38<#-- Pagination -->
39<#if totalPages gt 1>
40
41 <#assign
42 isFirstPage = currentPage == 1
43 isLastPage = currentPage == totalPages
44 previousStart = currentPage - 1
45 nextStart = currentPage + 1
46 />
47
48 <#macro pageUrl start>
49 ${iteratorURL}${urlSeparator}${curParam}=${start}
50 </#macro>
51
52 <nav class="pagination-bar" aria-label="Pagination">
53 <ul class="pagination">
54
55 <#-- Previous -->
56 <li class="page-item${isFirstPage?then(' disabled', '')}">
57 <#if isFirstPage>
58 <button
59 class="page-link"
60 type="button"
61 disabled
62 aria-label="Previous page"
63 >
64 <i class="dl-chevron-left-icon"></i>
65 </button>
66 <#else>
67 <a
68 class="page-link"
69 href="<@pageUrl previousStart />"
70 aria-label="Previous page"
71 >
72 <i class="dl-chevron-left-icon"></i>
73 </a>
74 </#if>
75 </li>
76
77 <#-- Pages -->
78 <#list 1..totalPages as page>
79 <#assign
80 isCurrentPage = page == currentPage
81 />
82
83 <li class="page-item${isCurrentPage?then(' active', '')}">
84 <#if isCurrentPage>
85 <span
86 class="page-link"
87 aria-current="page"
88 >
89 ${page}
90 </span>
91 <#else>
92 <a
93 class="page-link"
94 href="<@pageUrl page />"
95 aria-label="Page ${page}"
96 >
97 ${page}
98 </a>
99 </#if>
100 </li>
101 </#list>
102
103 <#-- Next -->
104 <li class="page-item${isLastPage?then(' disabled', '')}">
105 <#if isLastPage>
106 <button
107 class="page-link"
108 type="button"
109 disabled
110 aria-label="Next page"
111 >
112 <i class="dl-chevron-right-icon"></i>
113 </button>
114 <#else>
115 <a
116 class="page-link"
117 href="<@pageUrl nextStart />"
118 aria-label="Next page"
119 >
120 <i class="dl-chevron-right-icon"></i>
121 </a>
122 </#if>
123 </li>
124
125 </ul>
126 </nav>
127
128</#if>