show authors

This commit is contained in:
Tienson Qin
2025-12-30 12:36:34 +08:00
parent d53ea4a38c
commit 644ef4c34c
2 changed files with 39 additions and 5 deletions

View File

@@ -81,7 +81,8 @@ body {
h1 {
font-size: clamp(30px, 3.4vw, 44px);
margin: 16px 0 28px;
margin-top: 1.5em;
margin-bottom: 0.25em;
font-weight: 600;
letter-spacing: 0.01em;
}
@@ -642,12 +643,23 @@ a:hover {
.page-updated-at {
color: var(--muted);
font-size: 12px;
white-space: nowrap;
margin-bottom: 1rem;
margin-left: 2px;
}
.page-authors {
color: var(--muted);
white-space: nowrap;
margin-left: 2px;
}
.page-meta {
display: flex;
margin-bottom: 2rem;
gap: 8px;
font-size: 13px;
}
@media (max-width: 720px) {
.wrap {
margin: 16px;
@@ -682,6 +694,7 @@ a:hover {
}
.page-updated-at,
.page-authors,
.tagged-meta {
white-space: normal;
}

View File

@@ -1040,6 +1040,22 @@
(str "Block: " source-block-uuid))]]
[:span.tagged-meta (or (format-timestamp updated-at) "—")]]))
(defn- author-usernames
[entities page-eid page-entity]
(let [author-ids (->> entities
(keep (fn [[_e entity]]
(when (= (:block/page entity) page-eid)
(publish-model/ref-eid (:logseq.property/created-by-ref entity)))))
(concat [(publish-model/ref-eid (:logseq.property/created-by-ref page-entity))])
(remove nil?)
distinct)]
(->> author-ids
(map #(get entities %))
(keep publish-model/entity->title)
(remove string/blank?)
distinct
sort)))
(defn render-page-html
[transit page-uuid-str refs-data tagged-nodes]
(let [payload (publish-common/read-transit-safe transit)
@@ -1062,6 +1078,7 @@
(when (= (:block/uuid entity) page-uuid)
e))
entities)
authors (author-usernames entities page-eid page-entity)
uuid->title (reduce (fn [acc [_e entity]]
(if-let [uuid-value (:block/uuid entity)]
(assoc acc (str uuid-value) (publish-model/entity->title entity))
@@ -1177,8 +1194,12 @@
(theme-toggle-node))
(page-title-node page-title (:logseq.property/icon page-entity))
(let [updated-at (format-timestamp page-updated-at)]
[:div.page-updated-at updated-at])
[:div.page-meta
(when true
[:div.page-authors (str "By: " (string/join ", " authors))])
(let [updated-at (format-timestamp page-updated-at)]
[:div.page-updated-at updated-at])]
(when page-properties
[:section.page-properties