<% // Homepage — feed of posts. // // Renders BOTH a timeline view (.post-list, default) AND a grid view // (.feed-grid, square Instagram-style tiles). CSS toggles between the // two based on body[data-feed-view="timeline"|"grid"]. This mirrors the // v9 pattern in lib/template-content.php so the same view-switcher works. // // Pinned posts sort first inside the timeline list; they are not given a // separate "Pinned" header (v9 just lets order speak for itself + a ★ chip). const allPosts = [...pinnedPosts, ...posts]; const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : ''; %> <%# View switcher used to be rendered here; moved to shell.ejs (above #pcms-main) so it survives HTMX swaps and is visible on every non-admin page. %> <%# FEP-7628 slice 3: this account moved. The signpost comes FIRST, before any post: a visitor should not scroll a dead feed to find out we left. typeof-guard because an old route may render this template for one request right after a deploy (view cache fills on first hit). %> <% if (typeof movedTo !== 'undefined' && movedTo) { %>
<% } %>
<% if (allPosts.length === 0) { %>

<%= t('phome.empty_title') %>

<%= t('phome.empty_sub') %>

<% if (user && canMutate && permissions.canCreatePost(user, site)) { %>

<%= t('phome.write_first') %> →

<% } %>
<% } else { %> <% } %>
<% if (typeof readerItems !== 'undefined' && readerItems && readerItems.length) { %>
<% readerItems.forEach(function(it) { %> <%- include('../partials/read-article', { post: it.post, entry: it.entry }) %> <% }); %>
<% } %> <% if (allPosts.length > 0) { %>
<% allPosts.forEach(function(post) { %> <%- include('../partials/post-tile', { post: post }) %> <% }); %>
<% } %> <% if (typeof hasMore !== 'undefined' && allPosts.length > 0) { %>
<%- include('../partials/load-more', { hasMore: hasMore, nextOffset: nextOffset, moreBase: moreBase, moreTarget: '#post-list', morePath: '/' }) %>
<% } %>