Changeset d8c6a83 in Klonkt


Ignore:
Timestamp:
06/20/2026 08:29:48 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
d68bcf1
Parents:
cf0de0c
Message:

fix(downloads+posts): post nav on downloads page + post images full width

  • The pinned "Downloads!" is a real post with slug 'downloads'; the feature route /downloads intercepts it (no post nav). Now /downloads calculates the Newer/Older neighbours of that post and shows the post nav — download buttons remain.
  • Post images (.post-content img) always fill the container width with natural (uncropped) height. style.css?v=20.

Co-Authored-By: Claude <noreply@…>

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/assets/css/style.css

    rcf0de0c rd8c6a83  
    612612.post-image--right { text-align: right; }
    613613.post-image--right img { margin-left: auto; margin-right: 0; }
     614
     615/* Afbeeldingen in de post-tekst vullen ALTIJD de containerbreedte en houden hun
     616   natuurlijke (niet-bijgesneden) hoogte — geen vaste hoogte / geen crop. */
     617.post-content img {
     618    display: block;
     619    width: 100%;
     620    max-width: 100%;
     621    height: auto;
     622    border-radius: 6px;
     623    margin: 1.4em auto;
     624}
    614625
    615626/* Mini-player + bottom-tab clearance: applied to .pcms-main so the footer
  • src/routes/download.js

    rcf0de0c rd8c6a83  
    2020import { premiumUnlocked } from '../services/PatreonService.js';
    2121import { addSubscriber } from '../services/SubscriberService.js';
     22import { postNeighbors } from './posts.js';
    2223
    2324const router = express.Router();
     25
     26// Als er een echte (gepinde) post met slug 'downloads' bestaat, hangt de
     27// downloads-lijst feitelijk aan die post. Dan tonen we óók de Newer/Older-postnav,
     28// zodat de bezoeker net als bij een post verder kan bladeren.
     29function downloadsPostNav(req, res) {
     30  const site = res.locals.site;
     31  if (!site) return {};
     32  const post = db.prepare(
     33    "SELECT id, slug, pinned FROM posts WHERE site_id = ? AND slug = 'downloads' AND status = 'published'"
     34  ).get(site.id);
     35  if (!post) return {};
     36  try { return postNeighbors(site, post, res.locals.tenancy === 'hub'); } catch (e) { return {}; }
     37}
    2438const __dirname = path.dirname(fileURLToPath(import.meta.url));
    2539const AUDIO_DIR = path.resolve(process.env.AUDIO_PATH || path.join(__dirname, '..', '..', 'storage', 'audio'));
     
    5064      WHERE site_id = ? AND downloadable = 1 ORDER BY position ASC, created_at ASC`
    5165  ).all(site.id);
     66  const nav = downloadsPostNav(req, res);
    5267  renderPage(req, res, 'pages/downloads', {
    5368    pageTitle: 'Downloads — ' + (site.title || ''),
    5469    bodyClass: 'on-downloads',
    5570    dlTracks: tracks,
     71    newerPost: nav.newerPost || null,
     72    olderPost: nav.olderPost || null,
    5673  });
    5774});
  • src/routes/posts.js

    rcf0de0c rd8c6a83  
    718718
    719719export default router;
     720export { postNeighbors };
  • src/views/pages/downloads.ejs

    rcf0de0c rd8c6a83  
    33%>
    44<section class="dls">
     5  <%- include('../partials/post-nav', { newerPost: (typeof newerPost !== 'undefined' ? newerPost : null), olderPost: (typeof olderPost !== 'undefined' ? olderPost : null) }) %>
    56  <h1 class="dls-h1">Downloads</h1>
    67  <p class="dls-sub">Gratis te downloaden — laat je e-mailadres achter en je krijgt het bestand.</p>
  • src/views/shell.ejs

    rcf0de0c rd8c6a83  
    163163
    164164<!-- v9 stylesheet (full palette system) -->
    165 <link rel="stylesheet" href="/assets/css/style.css?v=19">
     165<link rel="stylesheet" href="/assets/css/style.css?v=20">
    166166
    167167<!-- Audio player styles: loaded on every page so the mini-player works
Note: See TracChangeset for help on using the changeset viewer.