Changeset 43dbf9c in Klonkt for src/views/partials/post-card.ejs


Ignore:
Timestamp:
06/16/2026 01:52:09 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
9f81a09
Parents:
aa7f548
Message:

Circles: /cirkel uses the home view (timeline + grid + switcher)

  • post-card/post-tile external-aware: post.external_url -> external link (target=_blank, no htmx) instead of local /slug. Additive; normal posts unchanged. post-card shows 'via <source>' when external.
  • circle.js maps remote_posts to the local post shape + bodyClass on-cirkel.
  • circle-feed.ejs: feed-timeline (.post-list) + feed-grid (.grid-tiles), same classes as home -> the view-switcher works. shell: on-cirkel = feed-page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/partials/post-card.ejs

    raa7f548 r43dbf9c  
    1212
    1313const _base      = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
    14 const _href      = _base + '/' + post.slug;
     14const _external  = post.external_url || null;
     15const _href      = _external || (_base + '/' + post.slug);
     16const _ext       = !!_external;
     17const _src       = post.source_name || '';
    1518const _hasCover  = !!post.cover_image_url;
    1619const _typeLabel = (post.type && post.type !== 'overig' && post.type !== 'post') ? post.type : '';
     
    4346  <% if (_hasCover) { %>
    4447    <a class="post-list-cover" href="<%= _href %>"
    45        hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
    46        hx-push-url="<%= _href %>" hx-indicator="#pcms-loading"
     48       <% 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"<% } %>
    4749       aria-label="<%= post.title || '(zonder titel)' %>" tabindex="-1">
    4850      <img src="<%= post.cover_image_url %>" alt="" loading="lazy" decoding="async">
     
    5456      <% if (_isPinned) { %><span class="post-list-pin" aria-label="Vastgepind">★</span><% } %>
    5557      <time datetime="<%= post.published_at || post.created_at %>"><%= _ddmmyyyy(post.published_at || post.created_at) %></time>
     58      <% if (_src) { %><span class="post-list-type">&middot; via <%= _src %></span><% } %>
    5659      <% if (_typeLabel) { %>
    5760        <span class="post-list-type">· <%= _typeLabel.charAt(0).toUpperCase() + _typeLabel.slice(1) %></span>
     
    6467    <h3 class="post-list-title">
    6568      <a href="<%= _href %>"
    66          hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
    67          hx-push-url="<%= _href %>" hx-indicator="#pcms-loading">
     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"<% } %>>
    6870        <%= post.title || '(zonder titel)' %>
    6971      </a>
Note: See TracChangeset for help on using the changeset viewer.