source: Klonkt/src/views/partials/post-tile.ejs@ 1907a18

main
Last change on this file since 1907a18 was 7963a6e, checked in by roboburr <roboburr@…>, 3 months ago

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@…>

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[7bc636b]1<%
2// Square Instagram-style tile for the .feed-grid view (v9 pattern).
3// - With cover → background-image, dark gradient overlay reveals title on hover/touch
4// - No cover → .grid-tile-gradient with the title centered (random hue per tile)
5const _tileHue = ((post.id || post.slug || '0').charCodeAt(0) * 7) % 360;
6const _isPinned = !!post.pinned;
7const _hasCover = !!post.cover_image_url;
8const _typeLabel = (post.type && post.type !== 'post') ? post.type : '';
[7963a6e]9const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
10const _href = _base + '/' + post.slug;
[7bc636b]11%>
12<a class="grid-tile<%= _hasCover ? '' : ' grid-tile-gradient' %><%= _isPinned ? ' is-pinned' : '' %>"
[7963a6e]13 href="<%= _href %>"
[7bc636b]14 <% if (_hasCover) { %>style="background-image: url('<%= post.cover_image_url %>'); --tile-hue: <%= _tileHue %>;"<% } else { %>style="--tile-hue: <%= _tileHue %>;"<% } %>
[7963a6e]15 hx-get="<%= _href %>?partial=1"
[7bc636b]16 hx-target="#pcms-main"
17 hx-swap="innerHTML"
[7963a6e]18 hx-push-url="<%= _href %>"
[7bc636b]19 hx-indicator="#pcms-loading">
20
21 <% if (_typeLabel) { %>
22 <span class="grid-tile-type"><%= _typeLabel %></span>
23 <% } %>
24 <% if (_isPinned) { %>
25 <span class="grid-tile-pin">Pinned</span>
26 <% } %>
27
28 <% if (_hasCover) { %>
29 <div class="grid-tile-overlay">
30 <strong><%= post.title || '(untitled)' %></strong>
31 </div>
32 <% } else { %>
33 <span class="grid-tile-title"><%= post.title || '(untitled)' %></span>
34 <% } %>
35</a>
Note: See TracBrowser for help on using the repository browser.