fix: show full AI summary and decode HTML entities
Remove CSS line-clamp that was truncating summaries to 3 lines (2 on mobile). The AI summary is 4 sentences and should be displayed in full. Also add decodeEntities() to clean up and ' artifacts in titles and summaries returned by the REST API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,10 +98,6 @@
|
|||||||
line-height: 1.65;
|
line-height: 1.65;
|
||||||
color: #4b5563;
|
color: #4b5563;
|
||||||
margin: 0 0 0.625rem;
|
margin: 0 0 0.625rem;
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Author ────────────────────────────────────────────────────── */
|
/* ── Author ────────────────────────────────────────────────────── */
|
||||||
@@ -305,7 +301,6 @@
|
|||||||
|
|
||||||
.pn-article-excerpt {
|
.pn-article-excerpt {
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pn-pagination {
|
.pn-pagination {
|
||||||
|
|||||||
@@ -21,6 +21,19 @@ const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|||||||
|
|
||||||
/* ── Utilities ──────────────────────────────────────────────────────── */
|
/* ── Utilities ──────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode HTML entities (e.g., &nbsp; ') to their plain-text equivalents.
|
||||||
|
*
|
||||||
|
* @param {string} str String potentially containing HTML entities.
|
||||||
|
* @returns {string} Decoded string.
|
||||||
|
*/
|
||||||
|
function decodeEntities(str) {
|
||||||
|
if (!str) return '';
|
||||||
|
const txt = document.createElement('textarea');
|
||||||
|
txt.innerHTML = str;
|
||||||
|
return txt.value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format an ISO date string to a human-readable form.
|
* Format an ISO date string to a human-readable form.
|
||||||
*
|
*
|
||||||
@@ -152,7 +165,7 @@ const Tag = memo(function Tag({
|
|||||||
const ArticleCard = memo(function ArticleCard({
|
const ArticleCard = memo(function ArticleCard({
|
||||||
article
|
article
|
||||||
}) {
|
}) {
|
||||||
const summary = article.ai_summary || article.excerpt || '';
|
const summary = decodeEntities(article.ai_summary || article.excerpt || '');
|
||||||
const tagSource = article.tags || article.categories || '';
|
const tagSource = article.tags || article.categories || '';
|
||||||
const tags = tagSource ? tagSource.split(',').map(t => t.trim()).filter(Boolean).slice(0, 5) : [];
|
const tags = tagSource ? tagSource.split(',').map(t => t.trim()).filter(Boolean).slice(0, 5) : [];
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
@@ -179,7 +192,7 @@ const ArticleCard = memo(function ArticleCard({
|
|||||||
onClick: handleClick,
|
onClick: handleClick,
|
||||||
target: "_blank",
|
target: "_blank",
|
||||||
rel: "noopener noreferrer"
|
rel: "noopener noreferrer"
|
||||||
}, article.title)), summary && /*#__PURE__*/React.createElement("p", {
|
}, decodeEntities(article.title))), summary && /*#__PURE__*/React.createElement("p", {
|
||||||
className: "pn-article-excerpt"
|
className: "pn-article-excerpt"
|
||||||
}, summary), article.author && /*#__PURE__*/React.createElement("span", {
|
}, summary), article.author && /*#__PURE__*/React.createElement("span", {
|
||||||
className: "pn-author"
|
className: "pn-author"
|
||||||
|
|||||||
Reference in New Issue
Block a user