Changeset 7963a6e in Klonkt


Ignore:
Timestamp:
06/14/2026 05:13:12 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
b94c08e
Parents:
0c2228a
Message:

fix: feed post links use siteUrlBase (clicking did not work in hub)

post-card + post-tile linked to '/<slug>' (absolute). In hub that falls back
to the main site -> 404 -> click did nothing. Now siteUrlBase + '/<slug>'
(and likewise for tag chips), so /user/<slug>/<post> in hub and '/<post>'
in solo.

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

Location:
src/views/partials
Files:
2 edited

Legend:

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

    r0c2228a r7963a6e  
    1111//   Hover state on cover. Tap-target stays large.
    1212
    13 const _href      = '/' + post.slug;
     13const _base      = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
     14const _href      = _base + '/' + post.slug;
    1415const _hasCover  = !!post.cover_image_url;
    1516const _typeLabel = (post.type && post.type !== 'overig' && post.type !== 'post') ? post.type : '';
     
    7677      <div class="post-list-tags">
    7778        <% _tags.forEach(function(t) { %>
    78           <a href="/tag/<%= encodeURIComponent(t) %>" class="tag-chip"
    79              hx-get="/tag/<%= encodeURIComponent(t) %>?partial=1" hx-target="#pcms-main"
    80              hx-swap="innerHTML" hx-push-url="/tag/<%= encodeURIComponent(t) %>"
     79          <a href="<%= _base %>/tag/<%= encodeURIComponent(t) %>" class="tag-chip"
     80             hx-get="<%= _base %>/tag/<%= encodeURIComponent(t) %>?partial=1" hx-target="#pcms-main"
     81             hx-swap="innerHTML" hx-push-url="<%= _base %>/tag/<%= encodeURIComponent(t) %>"
    8182             hx-indicator="#pcms-loading">#<%= t %></a>
    8283        <% }); %>
  • src/views/partials/post-tile.ejs

    r0c2228a r7963a6e  
    77const _hasCover = !!post.cover_image_url;
    88const _typeLabel = (post.type && post.type !== 'post') ? post.type : '';
     9const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
     10const _href = _base + '/' + post.slug;
    911%>
    1012<a class="grid-tile<%= _hasCover ? '' : ' grid-tile-gradient' %><%= _isPinned ? ' is-pinned' : '' %>"
    11    href="/<%= post.slug %>"
     13   href="<%= _href %>"
    1214   <% if (_hasCover) { %>style="background-image: url('<%= post.cover_image_url %>'); --tile-hue: <%= _tileHue %>;"<% } else { %>style="--tile-hue: <%= _tileHue %>;"<% } %>
    13    hx-get="/<%= post.slug %>?partial=1"
     15   hx-get="<%= _href %>?partial=1"
    1416   hx-target="#pcms-main"
    1517   hx-swap="innerHTML"
    16    hx-push-url="/<%= post.slug %>"
     18   hx-push-url="<%= _href %>"
    1719   hx-indicator="#pcms-loading">
    1820
Note: See TracChangeset for help on using the changeset viewer.