Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/search/client-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export default function RulesSearchClientPage({ ruleCount, latestRulesByUpdated
lastUpdated={result.lastUpdated}
index={index}
authorUrl={getAuthorUrl(result)}
snippet={result._snippetResult?.seoDescription?.value || result._snippetResult?.body?.value}
/>
))}
</div>
Expand Down
42 changes: 26 additions & 16 deletions components/RuleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ interface RuleCardProps {
index?: number;
authorUrl?: string | null;
skeletonMeta?: boolean;
snippet?: string | null;
}

function isHttpUrl(value?: string | null) {
if (!value) return false;
return /^https?:\/\//i.test(value.trim());
}

export default function RuleCard({ title, slug, lastUpdatedBy, lastUpdated, index, authorUrl, skeletonMeta }: RuleCardProps) {
export default function RuleCard({ title, slug, lastUpdatedBy, lastUpdated, index, authorUrl, skeletonMeta, snippet }: RuleCardProps) {
const showLink = !skeletonMeta && isHttpUrl(authorUrl) && (lastUpdatedBy || "Unknown") !== "Unknown";

return (
Expand All @@ -37,24 +38,33 @@ export default function RuleCard({ title, slug, lastUpdatedBy, lastUpdated, inde
<div className="h-3 w-16 rounded bg-gray-200" />
</div>
) : (
<h4 className="flex m-0 content-center text-lg text-gray-400">
<span className="font-medium">
{showLink ? (
<a href={authorUrl!} target="_blank" rel="noopener noreferrer nofollow" className="underline">
{lastUpdatedBy || "Unknown"}
</a>
) : (
<span>{lastUpdatedBy || "Unknown"}</span>
<>
<h4 className="flex m-0 content-center text-lg text-gray-400">
<span className="font-medium">
{showLink ? (
<a href={authorUrl!} target="_blank" rel="noopener noreferrer nofollow" className="underline">
{lastUpdatedBy || "Unknown"}
</a>
) : (
<span>{lastUpdatedBy || "Unknown"}</span>
)}
</span>

{lastUpdated && (
<div className="flex items-center ml-4 text-xs text-gray-400">
<RiTimeFill className="inline mr-1" />
<span>{timeAgo(lastUpdated)}</span>
</div>
)}
</span>
</h4>

{lastUpdated && (
<div className="flex items-center ml-4 text-xs text-gray-400">
<RiTimeFill className="inline mr-1" />
<span>{timeAgo(lastUpdated)}</span>
</div>
{snippet && (
<p
className="m-0 mt-1 text-sm text-gray-500 line-clamp-2 [&_em]:font-semibold [&_em]:not-italic [&_em]:text-gray-700"
dangerouslySetInnerHTML={{ __html: snippet }}
/>
)}
</h4>
</>
)}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions tina/collection/rule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const Rule: Collection = {
label: "SEO Description",
description:
"Page summary used for SEO. Can be generated with AI. See https://www.ssw.com.au/rules/html-meta-tags/#rectifying-the-missing-meta-tags-issue",
searchable: false,
searchable: true,
ui: {
component: ConditionalHiddenField,
...({ textarea: true, rows: 3 } as any),
Expand All @@ -201,7 +201,7 @@ const Rule: Collection = {
name: "body",
label: "Body",
isBody: true,
searchable: false,
searchable: true,
templates: embedTemplates,
toolbarOverride: toolbarFields,
ui: {
Expand Down
2 changes: 1 addition & 1 deletion tina/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const config = defineConfig({
stopwordLanguages: ["eng"],
},
indexBatchSize: 100,
maxSearchIndexFieldLength: 100,
maxSearchIndexFieldLength: 500,
},
repoProvider: {
defaultBranchName: branch,
Expand Down
2 changes: 1 addition & 1 deletion tina/tina-lock.json

Large diffs are not rendered by default.