| [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 || '';
|
|---|
| [2a10445] | 18 | const _realCover = !!post.cover_image_url || !!post.cover_video_url;
|
|---|
| 19 | // Content-derived fallback (see post-tile.ejs): a C2S post's media lives in
|
|---|
| 20 | // its content, and the card fronts it from there.
|
|---|
| 21 | let _cVideo = null, _cPoster = null, _cImg = null;
|
|---|
| 22 | if (!_realCover && post.content) {
|
|---|
| 23 | const vm = String(post.content).match(/<video[^>]*\ssrc="([^"]+)"[^>]*>/i);
|
|---|
| 24 | if (vm) { _cVideo = vm[1]; const pm = vm[0].match(/poster="([^"]+)"/i); if (pm) _cPoster = pm[1]; }
|
|---|
| 25 | else { const im = String(post.content).match(/<img[^>]*\ssrc="([^"]+)"/i); if (im) _cImg = im[1]; }
|
|---|
| 26 | }
|
|---|
| 27 | const _hasCover = _realCover || !!_cVideo || !!_cImg;
|
|---|
| [7bc636b] | 28 | const _typeLabel = (post.type && post.type !== 'overig' && post.type !== 'post') ? post.type : '';
|
|---|
| 29 | const _isPinned = !!post.pinned;
|
|---|
| [c7c7f02] | 30 | const _isBoost = !!post.isBoost;
|
|---|
| [7bc636b] | 31 | const _isDraft = post.status && post.status !== 'published';
|
|---|
| 32 |
|
|---|
| 33 | function _ddmmyyyy(iso) {
|
|---|
| 34 | if (!iso) return '';
|
|---|
| 35 | const d = new Date(iso);
|
|---|
| 36 | if (isNaN(d.getTime())) return '';
|
|---|
| 37 | const pad = n => String(n).padStart(2, '0');
|
|---|
| 38 | return pad(d.getDate()) + '-' + pad(d.getMonth() + 1) + '-' + d.getFullYear();
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | let _tags = [];
|
|---|
| 42 | if (post.tags) {
|
|---|
| 43 | if (Array.isArray(post.tags)) _tags = post.tags;
|
|---|
| 44 | else if (typeof post.tags === 'string') {
|
|---|
| 45 | try {
|
|---|
| 46 | const parsed = JSON.parse(post.tags);
|
|---|
| 47 | _tags = Array.isArray(parsed) ? parsed : post.tags.split(',').map(t => t.trim()).filter(Boolean);
|
|---|
| 48 | } catch (e) {
|
|---|
| 49 | _tags = post.tags.split(',').map(t => t.trim()).filter(Boolean);
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|
| 52 | }
|
|---|
| 53 | %>
|
|---|
| [515cf1a] | 54 | <li class="post-list-item<%= (_hasCover || post.nsfw) ? ' has-cover' : '' %><%= (_isPinned || _isBoost) ? ' is-pinned' : '' %>">
|
|---|
| [7bc636b] | 55 |
|
|---|
| 56 | <% if (_hasCover) { %>
|
|---|
| [837fc9c] | 57 | <a class="post-list-cover<%= post.nsfw ? ' nsfw-media' : '' %>" href="<%= _href %>"
|
|---|
| [43dbf9c] | 58 | <% 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] | 59 | aria-label="<%= post.title || '(zonder titel)' %>" tabindex="-1">
|
|---|
| [5f3f9ec] | 60 | <% if (post.cover_image_url) { %><img src="<%= thumb(post.cover_image_url, 480) %>"
|
|---|
| [93b147d] | 61 | srcset="<%= thumb(post.cover_image_url, 320) %> 320w, <%= thumb(post.cover_image_url, 640) %> 640w, <%= thumb(post.cover_image_url, 1280) %> 1280w"
|
|---|
| 62 | sizes="(min-width: 768px) 120px, 100vw"
|
|---|
| [adb6291] | 63 | alt="" loading="lazy" decoding="async"<% if (post.cover_video_url) { %> data-ios-mp4="<%= post.cover_video_url %>"<% } %>>
|
|---|
| [2a10445] | 64 | <% } else if (post.cover_video_url) { %><video src="<%= post.cover_video_url %>" poster="<%= thumb(post.cover_video_url, 480) %>" autoplay loop muted playsinline></video><% } else if (_cVideo) { %><video src="<%= _cVideo %>"<% if (_cPoster) { %> poster="<%= _cPoster %>"<% } %> autoplay loop muted playsinline preload="metadata"></video><% } else if (_cImg) { %><img src="<%= _cImg %>" alt="" loading="lazy" decoding="async"><% } %>
|
|---|
| [476d6e7] | 65 | <% if (post.nsfw) { %><span class="nsfw-veil"><%- include('nsfw-veil', { cw: post.content_warning }) %></span><% } %>
|
|---|
| [7bc636b] | 66 | </a>
|
|---|
| [515cf1a] | 67 | <% } else if (post.nsfw) { %>
|
|---|
| 68 | <a class="post-list-cover nsfw-media" href="<%= _href %>"
|
|---|
| 69 | <% 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"<% } %>
|
|---|
| 70 | aria-label="<%= post.title || '(zonder titel)' %>" tabindex="-1">
|
|---|
| [476d6e7] | 71 | <span class="nsfw-veil"><%- include('nsfw-veil', { cw: post.content_warning }) %></span>
|
|---|
| [515cf1a] | 72 | </a>
|
|---|
| [7bc636b] | 73 | <% } %>
|
|---|
| 74 |
|
|---|
| 75 | <div class="post-list-body">
|
|---|
| 76 | <div class="post-list-meta mono">
|
|---|
| [69e7a79] | 77 | <% 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] | 78 | <time datetime="<%= post.published_at || post.created_at %>"><%= _ddmmyyyy(post.published_at || post.created_at) %></time>
|
|---|
| [43dbf9c] | 79 | <% if (_src) { %><span class="post-list-type">· via <%= _src %></span><% } %>
|
|---|
| [7bc636b] | 80 | <% if (_typeLabel) { %>
|
|---|
| 81 | <span class="post-list-type">· <%= _typeLabel.charAt(0).toUpperCase() + _typeLabel.slice(1) %></span>
|
|---|
| 82 | <% } %>
|
|---|
| 83 | <% if (_isDraft) { %>
|
|---|
| 84 | <span class="post-list-type post-list-draft">· concept</span>
|
|---|
| 85 | <% } %>
|
|---|
| 86 | </div>
|
|---|
| 87 |
|
|---|
| 88 | <h3 class="post-list-title">
|
|---|
| 89 | <a href="<%= _href %>"
|
|---|
| [43dbf9c] | 90 | <% 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] | 91 | <%= post.title || '(zonder titel)' %>
|
|---|
| 92 | </a>
|
|---|
| 93 | </h3>
|
|---|
| 94 |
|
|---|
| 95 | <% if (post.excerpt) { %>
|
|---|
| 96 | <p class="post-list-excerpt"><%= post.excerpt %></p>
|
|---|
| 97 | <% } %>
|
|---|
| 98 |
|
|---|
| 99 | <% if (_tags.length) { %>
|
|---|
| 100 | <div class="post-list-tags">
|
|---|
| 101 | <% _tags.forEach(function(t) { %>
|
|---|
| [7963a6e] | 102 | <a href="<%= _base %>/tag/<%= encodeURIComponent(t) %>" class="tag-chip"
|
|---|
| 103 | hx-get="<%= _base %>/tag/<%= encodeURIComponent(t) %>?partial=1" hx-target="#pcms-main"
|
|---|
| 104 | hx-swap="innerHTML" hx-push-url="<%= _base %>/tag/<%= encodeURIComponent(t) %>"
|
|---|
| [7bc636b] | 105 | hx-indicator="#pcms-loading">#<%= t %></a>
|
|---|
| 106 | <% }); %>
|
|---|
| 107 | </div>
|
|---|
| 108 | <% } %>
|
|---|
| 109 | </div>
|
|---|
| 110 | </li>
|
|---|
| 111 |
|
|---|
| 112 | <style>
|
|---|
| 113 | /* ============================================================
|
|---|
| 114 | POST-LIST-ITEM — MOBILE-FIRST OVERRIDE
|
|---|
| 115 | The base v9 styles in /assets/css/style.css use a desktop
|
|---|
| 116 | 120×120 grid by default. We flip that: stacked on mobile,
|
|---|
| 117 | side-by-side on ≥768px.
|
|---|
| 118 | ============================================================ */
|
|---|
| 119 |
|
|---|
| 120 | /* Reset v9's grid on mobile and stack vertically */
|
|---|
| 121 | @media (max-width: 767px) {
|
|---|
| 122 | .post-list {
|
|---|
| 123 | gap: 2rem;
|
|---|
| 124 | }
|
|---|
| 125 | .post-list-item {
|
|---|
| 126 | display: flex !important;
|
|---|
| 127 | flex-direction: column;
|
|---|
| 128 | grid-template-columns: none !important;
|
|---|
| 129 | gap: .85rem !important;
|
|---|
| 130 | padding-bottom: 2rem;
|
|---|
| 131 | /* Active feedback for the whole card row */
|
|---|
| 132 | transition: transform 120ms ease, opacity 120ms ease;
|
|---|
| 133 | }
|
|---|
| 134 | .post-list-item:active {
|
|---|
| 135 | transform: scale(0.985);
|
|---|
| 136 | opacity: 0.85;
|
|---|
| 137 | }
|
|---|
| 138 | .post-list-item:last-child {
|
|---|
| 139 | border-bottom: none;
|
|---|
| 140 | padding-bottom: 0;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | /* Cover: full-bleed of the container, 16:9 ratio, no border-radius
|
|---|
| 144 | on small phones (edge-to-edge feels app-native). 8px radius from 480px+. */
|
|---|
| 145 | .post-list-cover {
|
|---|
| 146 | aspect-ratio: 16 / 9 !important;
|
|---|
| 147 | width: 100% !important;
|
|---|
| 148 | border-radius: 0 !important;
|
|---|
| 149 | /* Negative margin to break out of .container's padding */
|
|---|
| 150 | margin-left: calc(-1 * clamp(1.25rem, 4vw, 2rem));
|
|---|
| 151 | margin-right: calc(-1 * clamp(1.25rem, 4vw, 2rem));
|
|---|
| 152 | width: calc(100% + 2 * clamp(1.25rem, 4vw, 2rem)) !important;
|
|---|
| [a64d705] | 153 | /* Accent-gradient placeholder shown while the cover loads (the image fades in over it). */
|
|---|
| 154 | background-image: linear-gradient(135deg,
|
|---|
| 155 | color-mix(in srgb, var(--accent, #888) 22%, var(--paper-2)) 0%,
|
|---|
| 156 | color-mix(in srgb, var(--accent, #888) 6%, var(--paper-2)) 100%);
|
|---|
| [7bc636b] | 157 | }
|
|---|
| [65a0697] | 158 | .post-list-cover img, .post-list-cover video {
|
|---|
| [7bc636b] | 159 | width: 100%; height: 100%;
|
|---|
| 160 | object-fit: cover;
|
|---|
| 161 | display: block;
|
|---|
| [a64d705] | 162 | transition: opacity .4s ease;
|
|---|
| [7bc636b] | 163 | }
|
|---|
| [a64d705] | 164 | .post-list-cover img.is-loading { opacity: 0; }
|
|---|
| [7bc636b] | 165 |
|
|---|
| 166 | /* Re-apply rounded corners on slightly larger phones */
|
|---|
| 167 | @media (min-width: 480px) {
|
|---|
| 168 | .post-list-cover {
|
|---|
| 169 | border-radius: var(--radius) !important;
|
|---|
| 170 | margin-left: 0 !important;
|
|---|
| 171 | margin-right: 0 !important;
|
|---|
| 172 | width: 100% !important;
|
|---|
| 173 | }
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | /* Larger title for mobile readability */
|
|---|
| 177 | .post-list-title {
|
|---|
| 178 | font-size: 1.45rem !important;
|
|---|
| 179 | line-height: 1.2 !important;
|
|---|
| 180 | }
|
|---|
| 181 | .post-list-excerpt {
|
|---|
| 182 | font-size: 1rem !important;
|
|---|
| 183 | color: var(--ink-soft) !important;
|
|---|
| 184 | line-height: 1.55 !important;
|
|---|
| 185 | }
|
|---|
| 186 | .post-list-meta {
|
|---|
| 187 | font-size: .8rem !important;
|
|---|
| 188 | gap: .5rem !important;
|
|---|
| 189 | }
|
|---|
| 190 |
|
|---|
| 191 | /* Pinned indicator */
|
|---|
| 192 | .post-list-item.is-pinned .post-list-title a {
|
|---|
| 193 | /* No visual change on title — the ★ in meta is enough */
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | /* Tap targets for tags */
|
|---|
| 197 | .post-list-tags { gap: .4rem; }
|
|---|
| 198 | .tag-chip {
|
|---|
| 199 | min-height: 32px;
|
|---|
| 200 | display: inline-flex;
|
|---|
| 201 | align-items: center;
|
|---|
| 202 | padding: .2rem .65rem;
|
|---|
| 203 | }
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | /* ============================================================
|
|---|
| 207 | DESKTOP — keep v9's 120px-square pattern (style.css does this)
|
|---|
| 208 | We just enforce the layout here for clarity + override safety.
|
|---|
| 209 | ============================================================ */
|
|---|
| 210 | @media (min-width: 768px) {
|
|---|
| 211 | .post-list-item.has-cover {
|
|---|
| 212 | display: grid !important;
|
|---|
| 213 | grid-template-columns: 120px 1fr !important;
|
|---|
| 214 | gap: 1.25rem !important;
|
|---|
| 215 | }
|
|---|
| 216 | .post-list-item:not(.has-cover) {
|
|---|
| 217 | grid-template-columns: 1fr !important;
|
|---|
| 218 | }
|
|---|
| 219 | .post-list-cover {
|
|---|
| 220 | aspect-ratio: 1 !important;
|
|---|
| 221 | border-radius: var(--radius) !important;
|
|---|
| 222 | }
|
|---|
| 223 | /* Hover lift on desktop (touch devices use :active above) */
|
|---|
| 224 | @media (hover: hover) {
|
|---|
| 225 | .post-list-cover {
|
|---|
| 226 | transition: transform 200ms ease;
|
|---|
| 227 | }
|
|---|
| 228 | .post-list-item:hover .post-list-cover {
|
|---|
| 229 | transform: scale(1.02);
|
|---|
| 230 | }
|
|---|
| 231 | }
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | /* ============================================================
|
|---|
| 235 | PIN + DRAFT INDICATORS (shared)
|
|---|
| 236 | ============================================================ */
|
|---|
| 237 | .post-list-pin {
|
|---|
| 238 | color: var(--accent);
|
|---|
| 239 | margin-right: .35rem;
|
|---|
| [69e7a79] | 240 | display: inline-flex;
|
|---|
| 241 | align-items: center;
|
|---|
| 242 | vertical-align: middle;
|
|---|
| [7bc636b] | 243 | }
|
|---|
| [69e7a79] | 244 | .post-list-pin svg { width: 13px; height: 13px; display: block; }
|
|---|
| 245 | .post-list-boost { color: #2fa85a; }
|
|---|
| [7bc636b] | 246 | .post-list-draft {
|
|---|
| 247 | color: var(--accent);
|
|---|
| 248 | font-style: italic;
|
|---|
| 249 | }
|
|---|
| 250 | </style>
|
|---|