| [7bc636b] | 1 | <%
|
|---|
| 2 | // Post list item โ MOBILE-FIRST.
|
|---|
| 3 | //
|
|---|
| 4 | // <768px (default):
|
|---|
| 5 | // Vertical stack โ full-bleed 16:9 cover on top, content below.
|
|---|
| 6 | // Whole card is tappable (one big <a> wrapping everything).
|
|---|
| 7 | // Active state: scale(0.985) + opacity dim.
|
|---|
| 8 | //
|
|---|
| 9 | // โฅ768px (desktop):
|
|---|
| 10 | // v9 pattern โ 120px square cover left, content right.
|
|---|
| 11 | // Hover state on cover. Tap-target stays large.
|
|---|
| 12 |
|
|---|
| [7963a6e] | 13 | const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
|
|---|
| [43dbf9c] | 14 | const _external = post.external_url || null;
|
|---|
| 15 | const _href = _external || (_base + '/' + post.slug);
|
|---|
| 16 | const _ext = !!_external;
|
|---|
| 17 | const _src = post.source_name || '';
|
|---|
| [7bc636b] | 18 | const _hasCover = !!post.cover_image_url;
|
|---|
| 19 | const _typeLabel = (post.type && post.type !== 'overig' && post.type !== 'post') ? post.type : '';
|
|---|
| 20 | const _isPinned = !!post.pinned;
|
|---|
| [c7c7f02] | 21 | const _isBoost = !!post.isBoost;
|
|---|
| [7bc636b] | 22 | const _isDraft = post.status && post.status !== 'published';
|
|---|
| 23 |
|
|---|
| 24 | function _ddmmyyyy(iso) {
|
|---|
| 25 | if (!iso) return '';
|
|---|
| 26 | const d = new Date(iso);
|
|---|
| 27 | if (isNaN(d.getTime())) return '';
|
|---|
| 28 | const pad = n => String(n).padStart(2, '0');
|
|---|
| 29 | return pad(d.getDate()) + '-' + pad(d.getMonth() + 1) + '-' + d.getFullYear();
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | let _tags = [];
|
|---|
| 33 | if (post.tags) {
|
|---|
| 34 | if (Array.isArray(post.tags)) _tags = post.tags;
|
|---|
| 35 | else if (typeof post.tags === 'string') {
|
|---|
| 36 | try {
|
|---|
| 37 | const parsed = JSON.parse(post.tags);
|
|---|
| 38 | _tags = Array.isArray(parsed) ? parsed : post.tags.split(',').map(t => t.trim()).filter(Boolean);
|
|---|
| 39 | } catch (e) {
|
|---|
| 40 | _tags = post.tags.split(',').map(t => t.trim()).filter(Boolean);
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 | %>
|
|---|
| [c7c7f02] | 45 | <li class="post-list-item<%= _hasCover ? ' has-cover' : '' %><%= (_isPinned || _isBoost) ? ' is-pinned' : '' %>">
|
|---|
| [7bc636b] | 46 |
|
|---|
| 47 | <% if (_hasCover) { %>
|
|---|
| 48 | <a class="post-list-cover" href="<%= _href %>"
|
|---|
| [43dbf9c] | 49 | <% if (_ext) { %>target="_blank" rel="noopener"<% } else { %>hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="<%= _href %>" hx-indicator="#pcms-loading"<% } %>
|
|---|
| [7bc636b] | 50 | aria-label="<%= post.title || '(zonder titel)' %>" tabindex="-1">
|
|---|
| 51 | <img src="<%= post.cover_image_url %>" alt="" loading="lazy" decoding="async">
|
|---|
| 52 | </a>
|
|---|
| 53 | <% } %>
|
|---|
| 54 |
|
|---|
| 55 | <div class="post-list-body">
|
|---|
| 56 | <div class="post-list-meta mono">
|
|---|
| [69e7a79] | 57 | <% if (_isBoost) { %><span class="post-list-pin post-list-boost" aria-label="Boost"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg></span><% } else if (_isPinned) { %><span class="post-list-pin" aria-label="Vastgepind"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="12" y1="17" x2="12" y2="22"/><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24z"/></svg></span><% } %>
|
|---|
| [7bc636b] | 58 | <time datetime="<%= post.published_at || post.created_at %>"><%= _ddmmyyyy(post.published_at || post.created_at) %></time>
|
|---|
| [43dbf9c] | 59 | <% if (_src) { %><span class="post-list-type">· via <%= _src %></span><% } %>
|
|---|
| [7bc636b] | 60 | <% if (_typeLabel) { %>
|
|---|
| 61 | <span class="post-list-type">ยท <%= _typeLabel.charAt(0).toUpperCase() + _typeLabel.slice(1) %></span>
|
|---|
| 62 | <% } %>
|
|---|
| 63 | <% if (_isDraft) { %>
|
|---|
| 64 | <span class="post-list-type post-list-draft">ยท concept</span>
|
|---|
| 65 | <% } %>
|
|---|
| 66 | </div>
|
|---|
| 67 |
|
|---|
| 68 | <h3 class="post-list-title">
|
|---|
| 69 | <a href="<%= _href %>"
|
|---|
| [43dbf9c] | 70 | <% if (_ext) { %>target="_blank" rel="noopener"<% } else { %>hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="<%= _href %>" hx-indicator="#pcms-loading"<% } %>>
|
|---|
| [7bc636b] | 71 | <%= post.title || '(zonder titel)' %>
|
|---|
| 72 | </a>
|
|---|
| 73 | </h3>
|
|---|
| 74 |
|
|---|
| 75 | <% if (post.excerpt) { %>
|
|---|
| 76 | <p class="post-list-excerpt"><%= post.excerpt %></p>
|
|---|
| 77 | <% } %>
|
|---|
| 78 |
|
|---|
| 79 | <% if (_tags.length) { %>
|
|---|
| 80 | <div class="post-list-tags">
|
|---|
| 81 | <% _tags.forEach(function(t) { %>
|
|---|
| [7963a6e] | 82 | <a href="<%= _base %>/tag/<%= encodeURIComponent(t) %>" class="tag-chip"
|
|---|
| 83 | hx-get="<%= _base %>/tag/<%= encodeURIComponent(t) %>?partial=1" hx-target="#pcms-main"
|
|---|
| 84 | hx-swap="innerHTML" hx-push-url="<%= _base %>/tag/<%= encodeURIComponent(t) %>"
|
|---|
| [7bc636b] | 85 | hx-indicator="#pcms-loading">#<%= t %></a>
|
|---|
| 86 | <% }); %>
|
|---|
| 87 | </div>
|
|---|
| 88 | <% } %>
|
|---|
| 89 | </div>
|
|---|
| 90 | </li>
|
|---|
| 91 |
|
|---|
| 92 | <style>
|
|---|
| 93 | /* ============================================================
|
|---|
| 94 | POST-LIST-ITEM โ MOBILE-FIRST OVERRIDE
|
|---|
| 95 | The base v9 styles in /assets/css/style.css use a desktop
|
|---|
| 96 | 120ร120 grid by default. We flip that: stacked on mobile,
|
|---|
| 97 | side-by-side on โฅ768px.
|
|---|
| 98 | ============================================================ */
|
|---|
| 99 |
|
|---|
| 100 | /* Reset v9's grid on mobile and stack vertically */
|
|---|
| 101 | @media (max-width: 767px) {
|
|---|
| 102 | .post-list {
|
|---|
| 103 | gap: 2rem;
|
|---|
| 104 | }
|
|---|
| 105 | .post-list-item {
|
|---|
| 106 | display: flex !important;
|
|---|
| 107 | flex-direction: column;
|
|---|
| 108 | grid-template-columns: none !important;
|
|---|
| 109 | gap: .85rem !important;
|
|---|
| 110 | padding-bottom: 2rem;
|
|---|
| 111 | /* Active feedback for the whole card row */
|
|---|
| 112 | transition: transform 120ms ease, opacity 120ms ease;
|
|---|
| 113 | }
|
|---|
| 114 | .post-list-item:active {
|
|---|
| 115 | transform: scale(0.985);
|
|---|
| 116 | opacity: 0.85;
|
|---|
| 117 | }
|
|---|
| 118 | .post-list-item:last-child {
|
|---|
| 119 | border-bottom: none;
|
|---|
| 120 | padding-bottom: 0;
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | /* Cover: full-bleed of the container, 16:9 ratio, no border-radius
|
|---|
| 124 | on small phones (edge-to-edge feels app-native). 8px radius from 480px+. */
|
|---|
| 125 | .post-list-cover {
|
|---|
| 126 | aspect-ratio: 16 / 9 !important;
|
|---|
| 127 | width: 100% !important;
|
|---|
| 128 | border-radius: 0 !important;
|
|---|
| 129 | /* Negative margin to break out of .container's padding */
|
|---|
| 130 | margin-left: calc(-1 * clamp(1.25rem, 4vw, 2rem));
|
|---|
| 131 | margin-right: calc(-1 * clamp(1.25rem, 4vw, 2rem));
|
|---|
| 132 | width: calc(100% + 2 * clamp(1.25rem, 4vw, 2rem)) !important;
|
|---|
| 133 | background: var(--paper-2);
|
|---|
| 134 | }
|
|---|
| 135 | .post-list-cover img {
|
|---|
| 136 | width: 100%; height: 100%;
|
|---|
| 137 | object-fit: cover;
|
|---|
| 138 | display: block;
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | /* Re-apply rounded corners on slightly larger phones */
|
|---|
| 142 | @media (min-width: 480px) {
|
|---|
| 143 | .post-list-cover {
|
|---|
| 144 | border-radius: var(--radius) !important;
|
|---|
| 145 | margin-left: 0 !important;
|
|---|
| 146 | margin-right: 0 !important;
|
|---|
| 147 | width: 100% !important;
|
|---|
| 148 | }
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | /* Larger title for mobile readability */
|
|---|
| 152 | .post-list-title {
|
|---|
| 153 | font-size: 1.45rem !important;
|
|---|
| 154 | line-height: 1.2 !important;
|
|---|
| 155 | }
|
|---|
| 156 | .post-list-excerpt {
|
|---|
| 157 | font-size: 1rem !important;
|
|---|
| 158 | color: var(--ink-soft) !important;
|
|---|
| 159 | line-height: 1.55 !important;
|
|---|
| 160 | }
|
|---|
| 161 | .post-list-meta {
|
|---|
| 162 | font-size: .8rem !important;
|
|---|
| 163 | gap: .5rem !important;
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | /* Pinned indicator */
|
|---|
| 167 | .post-list-item.is-pinned .post-list-title a {
|
|---|
| 168 | /* No visual change on title โ the โ
in meta is enough */
|
|---|
| 169 | }
|
|---|
| 170 |
|
|---|
| 171 | /* Tap targets for tags */
|
|---|
| 172 | .post-list-tags { gap: .4rem; }
|
|---|
| 173 | .tag-chip {
|
|---|
| 174 | min-height: 32px;
|
|---|
| 175 | display: inline-flex;
|
|---|
| 176 | align-items: center;
|
|---|
| 177 | padding: .2rem .65rem;
|
|---|
| 178 | }
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 | /* ============================================================
|
|---|
| 182 | DESKTOP โ keep v9's 120px-square pattern (style.css does this)
|
|---|
| 183 | We just enforce the layout here for clarity + override safety.
|
|---|
| 184 | ============================================================ */
|
|---|
| 185 | @media (min-width: 768px) {
|
|---|
| 186 | .post-list-item.has-cover {
|
|---|
| 187 | display: grid !important;
|
|---|
| 188 | grid-template-columns: 120px 1fr !important;
|
|---|
| 189 | gap: 1.25rem !important;
|
|---|
| 190 | }
|
|---|
| 191 | .post-list-item:not(.has-cover) {
|
|---|
| 192 | grid-template-columns: 1fr !important;
|
|---|
| 193 | }
|
|---|
| 194 | .post-list-cover {
|
|---|
| 195 | aspect-ratio: 1 !important;
|
|---|
| 196 | border-radius: var(--radius) !important;
|
|---|
| 197 | }
|
|---|
| 198 | /* Hover lift on desktop (touch devices use :active above) */
|
|---|
| 199 | @media (hover: hover) {
|
|---|
| 200 | .post-list-cover {
|
|---|
| 201 | transition: transform 200ms ease;
|
|---|
| 202 | }
|
|---|
| 203 | .post-list-item:hover .post-list-cover {
|
|---|
| 204 | transform: scale(1.02);
|
|---|
| 205 | }
|
|---|
| 206 | }
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | /* ============================================================
|
|---|
| 210 | PIN + DRAFT INDICATORS (shared)
|
|---|
| 211 | ============================================================ */
|
|---|
| 212 | .post-list-pin {
|
|---|
| 213 | color: var(--accent);
|
|---|
| 214 | margin-right: .35rem;
|
|---|
| [69e7a79] | 215 | display: inline-flex;
|
|---|
| 216 | align-items: center;
|
|---|
| 217 | vertical-align: middle;
|
|---|
| [7bc636b] | 218 | }
|
|---|
| [69e7a79] | 219 | .post-list-pin svg { width: 13px; height: 13px; display: block; }
|
|---|
| 220 | .post-list-boost { color: #2fa85a; }
|
|---|
| [7bc636b] | 221 | .post-list-draft {
|
|---|
| 222 | color: var(--accent);
|
|---|
| 223 | font-style: italic;
|
|---|
| 224 | }
|
|---|
| 225 | </style>
|
|---|