@grove-dev/astro 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/server/models.ts +21 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grove-dev/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Astro integration + server view-models for Grove directories. UI ships from @grove-dev/registry, not from this package.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"sanitize-html": "^2.17.5",
|
|
52
52
|
"shiki": "^1.29.2",
|
|
53
53
|
"yaml": "^2.9.0",
|
|
54
|
-
"@grove-dev/core": "0.
|
|
54
|
+
"@grove-dev/core": "0.9.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"astro": "^6.0.0 || ^7.0.0"
|
package/src/server/models.ts
CHANGED
|
@@ -613,7 +613,7 @@ export function getRecordDetailModel(
|
|
|
613
613
|
siteName: site.name,
|
|
614
614
|
});
|
|
615
615
|
const description = seoDescription(
|
|
616
|
-
(record.summary && record.summary.trim()) || record.description,
|
|
616
|
+
record.seo?.description || (record.summary && record.summary.trim()) || record.description,
|
|
617
617
|
fallbackSentence,
|
|
618
618
|
);
|
|
619
619
|
const repoUrl = proj?.repoUrl ?? record.links?.github ?? '';
|
|
@@ -639,6 +639,9 @@ export function getRecordDetailModel(
|
|
|
639
639
|
const reviewedAtLabel = record.curation?.reviewedAt
|
|
640
640
|
? new Date(String(record.curation.reviewedAt)).toLocaleDateString()
|
|
641
641
|
: null;
|
|
642
|
+
const addedAtLabel = record.addedAt
|
|
643
|
+
? new Date(String(record.addedAt)).toLocaleDateString()
|
|
644
|
+
: null;
|
|
642
645
|
const isArchived = !!github?.archived;
|
|
643
646
|
const isDisabled = !!github?.disabled;
|
|
644
647
|
const ownerRepo = repoUrl ? getOwnerAndRepoFromRepoUrl(repoUrl) : null;
|
|
@@ -682,7 +685,11 @@ export function getRecordDetailModel(
|
|
|
682
685
|
let recordLd: Record<string, unknown>;
|
|
683
686
|
if (isProject && proj) {
|
|
684
687
|
const sameAs = [repoUrl, homepageUrl].filter(Boolean);
|
|
685
|
-
|
|
688
|
+
// schema.org `dateCreated` is when the *work* was created, so the
|
|
689
|
+
// repository's own creation date is the honest answer. This used to
|
|
690
|
+
// read `curation.reviewedAt` and published the review date as the
|
|
691
|
+
// project's birthday — off by years on most records.
|
|
692
|
+
const dateCreated = github?.created_at ? String(github.created_at) : undefined;
|
|
686
693
|
recordLd = {
|
|
687
694
|
'@context': 'https://schema.org',
|
|
688
695
|
'@type': 'SoftwareSourceCode',
|
|
@@ -756,13 +763,15 @@ export function getRecordDetailModel(
|
|
|
756
763
|
}
|
|
757
764
|
|
|
758
765
|
// "<Name> — <descriptor> | <Site>": the descriptor gives the search
|
|
759
|
-
// snippet a reason to exist beyond the bare project name.
|
|
766
|
+
// snippet a reason to exist beyond the bare project name. A curator's
|
|
767
|
+
// `record.seo.title` (when set) is used verbatim, same override
|
|
768
|
+
// pattern as `getCollectionPageModel`'s `collection.seo?.title`.
|
|
760
769
|
const descriptor = recordSeoDescriptor({
|
|
761
770
|
summary: record.summary,
|
|
762
771
|
...(categoryLabel ? { categoryLabel } : {}),
|
|
763
772
|
singular,
|
|
764
773
|
});
|
|
765
|
-
const title = seoTitle(`${name} — ${descriptor}`, site.name);
|
|
774
|
+
const title = record.seo?.title ?? seoTitle(`${name} — ${descriptor}`, site.name);
|
|
766
775
|
const pluralTitle = titleCaseFirst(site.blueprintConfig?.labelPlural ?? itemLabelPlural());
|
|
767
776
|
const jsonLd = [
|
|
768
777
|
recordLd,
|
|
@@ -806,6 +815,7 @@ export function getRecordDetailModel(
|
|
|
806
815
|
firstCommitYear,
|
|
807
816
|
lastFetchedLabel,
|
|
808
817
|
reviewedAtLabel,
|
|
818
|
+
addedAtLabel,
|
|
809
819
|
ownerRepo,
|
|
810
820
|
avatarSrc,
|
|
811
821
|
initials: name
|
|
@@ -867,6 +877,7 @@ export function getRecordDetailModel(
|
|
|
867
877
|
category: record.category,
|
|
868
878
|
contributionSignals,
|
|
869
879
|
reviewedAt: record.curation?.reviewedAt,
|
|
880
|
+
addedAt: record.addedAt,
|
|
870
881
|
}),
|
|
871
882
|
// ── Body-derived fields ──────────────────────────────────
|
|
872
883
|
// Both depend on the sidecar Markdown; the body is re-read
|
|
@@ -976,6 +987,7 @@ export function computeSidebarVisibility(input: {
|
|
|
976
987
|
category: string | undefined;
|
|
977
988
|
contributionSignals: Array<{ key: string; label: string; ok: boolean }>;
|
|
978
989
|
reviewedAt: string | undefined;
|
|
990
|
+
addedAt: string | undefined;
|
|
979
991
|
}): {
|
|
980
992
|
showActivity: boolean;
|
|
981
993
|
showFreshness: boolean;
|
|
@@ -994,7 +1006,11 @@ export function computeSidebarVisibility(input: {
|
|
|
994
1006
|
input.tags.length > 0 ||
|
|
995
1007
|
!!input.category ||
|
|
996
1008
|
input.contributionSignals.length > 0,
|
|
997
|
-
|
|
1009
|
+
// Was `!!input.reviewedAt`, which hid the whole Source card — and
|
|
1010
|
+
// with it "Also in" and the notes word count — on every record a
|
|
1011
|
+
// curator had not stamped. `addedAt` is set on every record, so the
|
|
1012
|
+
// card now renders for all of them.
|
|
1013
|
+
showSource: !!input.addedAt || !!input.reviewedAt,
|
|
998
1014
|
};
|
|
999
1015
|
}
|
|
1000
1016
|
|