@scribe-atp/next 1.1.0 → 1.1.1
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/README.md +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,23 @@ The metadata generators are opinionated by design. They produce complete, ready-
|
|
|
91
91
|
|
|
92
92
|
Article metadata uses the cached `ArticleRef` snapshot already present in the site record — no extra network request per article at build time.
|
|
93
93
|
|
|
94
|
+
### Standalone metadata helpers
|
|
95
|
+
|
|
96
|
+
Outside the factory pattern, `articleMetadata` and `siteMetadata` are exported as standalone functions that accept an `Article`/`Site` object directly. These are useful when you're already fetching content yourself and just need the `Metadata` object:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { articleMetadata, siteMetadata } from "@scribe-atp/next";
|
|
100
|
+
import { fetchArticleBySlug, fetchSite } from "@scribe-atp/core";
|
|
101
|
+
|
|
102
|
+
export async function generateMetadata({ params }: { params: { slug: string } }) {
|
|
103
|
+
const [{ article }, site] = await Promise.all([
|
|
104
|
+
fetchArticleBySlug("alice.bsky.social", "https://alice.bsky.social", params.slug),
|
|
105
|
+
fetchSite("alice.bsky.social", "https://alice.bsky.social"),
|
|
106
|
+
]);
|
|
107
|
+
return articleMetadata(article, site);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
94
111
|
**Need custom metadata?** Call `fetchSite` or `fetchArticle` from `@scribe-atp/core` directly and compose your own `Metadata` object:
|
|
95
112
|
|
|
96
113
|
```ts
|