source: Klonkt/src/views/pages/hub-home.ejs@ bf61be7

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

hub: company overview on / (latest posts from all users) + /user/ routing

In hub mode '/' is no longer the primary PrutFolio but an overview:
hero (company site title) + "Latest posts" across ALL sites + "PrutFolio's"
list. Solo keeps '/' as the single PrutFolio.

  • routes/hub.js: GET / -> hub overview in hub, otherwise next() (solo -> posts.js).
  • views/pages/hub-home.ejs: overview layout (cards + user list).
  • middleware/site.js: PrutFolio's now accessible via /user/:slug (canonical) and /sites/:slug (legacy); siteUrlBase follows the used prefix.
  • server.js: hubRoutes mounted before postsRoutes.

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

  • Property mode set to 100644
File size: 5.0 KB
RevLine 
[bf61be7]1<div class="container hub-home">
2
3 <header class="hub-hero">
4 <h1><%= company ? company.title : 'Overzicht' %></h1>
5 <% if (company && (company.tagline || company.description)) { %>
6 <p class="hub-hero-sub"><%= company.tagline || company.description %></p>
7 <% } %>
8 </header>
9
10 <%# ── Laatste posts van alle gebruikers ─────────────────────────── %>
11 <section class="hub-section">
12 <h2 class="hub-h2">Laatste posts</h2>
13 <% if (posts && posts.length) { %>
14 <div class="hub-grid">
15 <% posts.forEach(function(p) { %>
16 <a class="hub-card" href="/user/<%= p.site_slug %>/<%= p.slug %>">
17 <% if (p.cover_image_url) { %>
18 <span class="hub-card-cover" style="background-image:url('<%= p.cover_image_url %>')"></span>
19 <% } %>
20 <span class="hub-card-body">
21 <span class="hub-card-title"><%= p.title %></span>
22 <% if (p.excerpt) { %><span class="hub-card-excerpt"><%= p.excerpt %></span><% } %>
23 <span class="hub-card-meta">
24 <%= p.site_title %><% if (p.published_at || p.created_at) { %> · <%= formatDate(p.published_at || p.created_at) %><% } %>
25 </span>
26 </span>
27 </a>
28 <% }); %>
29 </div>
30 <% } else { %>
31 <p class="hub-empty">Nog geen posts.</p>
32 <% } %>
33 </section>
34
35 <%# ── PrutFolio's (gebruikers) ───────────────────────────────────── %>
36 <section class="hub-section">
37 <h2 class="hub-h2">PrutFolio's</h2>
38 <% if (sites && sites.length) { %>
39 <ul class="hub-users">
40 <% sites.forEach(function(s) { %>
41 <li>
42 <a class="hub-user" href="/user/<%= s.slug %>">
43 <span class="hub-user-avatar">
44 <% if (s.profile_photo) { %>
45 <img src="<%= s.profile_photo %>" alt="">
46 <% } else { %>
47 <span><%= (s.title || s.slug).charAt(0).toUpperCase() %></span>
48 <% } %>
49 </span>
50 <span class="hub-user-meta">
51 <span class="hub-user-name"><%= s.title %></span>
52 <span class="hub-user-sub"><%= s.post_count %> post<%= s.post_count === 1 ? '' : 's' %></span>
53 </span>
54 </a>
55 </li>
56 <% }); %>
57 </ul>
58 <% } else { %>
59 <p class="hub-empty">Nog geen gebruikers.</p>
60 <% } %>
61 </section>
62
63</div>
64
65<style>
66.hub-home { max-width: 1040px; margin: 2rem auto 4rem; padding: 0 1rem; }
67.hub-hero { text-align: center; padding: 1.5rem 0 2rem; border-bottom: 1px solid var(--rule); margin-bottom: 2rem; }
68.hub-hero h1 { font-family: var(--font-display, serif); font-size: 2.4rem; margin: 0 0 0.4rem; }
69.hub-hero-sub { color: var(--ink-muted); font-size: 1.05rem; margin: 0; }
70
71.hub-section { margin-bottom: 2.5rem; }
72.hub-h2 { font-family: var(--font-display, serif); font-size: 1.3rem; margin: 0 0 1rem; }
73
74.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
75.hub-card {
76 display: flex; flex-direction: column;
77 border: 1px solid var(--rule); border-radius: 10px; overflow: hidden;
78 background: var(--paper-2); color: var(--ink); text-decoration: none;
79 transition: border-color 120ms, transform 120ms;
80}
81.hub-card:hover { border-color: var(--accent); transform: translateY(-2px); }
82.hub-card-cover { display: block; height: 130px; background-size: cover; background-position: center; background-color: var(--paper); }
83.hub-card-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.85rem 1rem; }
84.hub-card-title { font-weight: 600; font-size: 1.02rem; line-height: 1.25; }
85.hub-card-excerpt { color: var(--ink-muted); font-size: 0.88rem; line-height: 1.4;
86 display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
87.hub-card-meta { color: var(--ink-muted); font-size: 0.78rem; margin-top: 0.1rem; }
88
89.hub-users { list-style: none; padding: 0; margin: 0;
90 display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }
91.hub-user { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem;
92 border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2);
93 color: var(--ink); text-decoration: none; transition: border-color 120ms; }
94.hub-user:hover { border-color: var(--accent); }
95.hub-user-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
96 background: var(--paper); color: var(--accent); display: inline-flex; align-items: center; justify-content: center;
97 font-family: var(--font-display, serif); font-weight: 600; }
98.hub-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
99.hub-user-meta { display: flex; flex-direction: column; min-width: 0; }
100.hub-user-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
101.hub-user-sub { color: var(--ink-muted); font-size: 0.8rem; }
102
103.hub-empty { color: var(--ink-muted); }
104</style>
Note: See TracBrowser for help on using the repository browser.