main
|
Last change
on this file since 8afbdd6 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
|
| Line | |
|---|
| 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)
|
|---|
| 5 | const _tileHue = ((post.id || post.slug || '0').charCodeAt(0) * 7) % 360;
|
|---|
| 6 | const _isPinned = !!post.pinned;
|
|---|
| 7 | const _hasCover = !!post.cover_image_url;
|
|---|
| 8 | const _typeLabel = (post.type && post.type !== 'post') ? post.type : '';
|
|---|
| 9 | const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
|
|---|
| 10 | const _href = _base + '/' + post.slug;
|
|---|
| 11 | %>
|
|---|
| 12 | <a class="grid-tile<%= _hasCover ? '' : ' grid-tile-gradient' %><%= _isPinned ? ' is-pinned' : '' %>"
|
|---|
| 13 | href="<%= _href %>"
|
|---|
| 14 | <% if (_hasCover) { %>style="background-image: url('<%= post.cover_image_url %>'); --tile-hue: <%= _tileHue %>;"<% } else { %>style="--tile-hue: <%= _tileHue %>;"<% } %>
|
|---|
| 15 | hx-get="<%= _href %>?partial=1"
|
|---|
| 16 | hx-target="#pcms-main"
|
|---|
| 17 | hx-swap="innerHTML"
|
|---|
| 18 | hx-push-url="<%= _href %>"
|
|---|
| 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.