@jxsuite/feed 0.3.7 → 0.4.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/LICENSE +1 -1
- package/dist/feed.js +1 -1
- package/package.json +2 -2
- package/src/Feed.class.json +1 -1
- package/src/shared.ts +9 -1
package/LICENSE
CHANGED
package/dist/feed.js
CHANGED
|
@@ -157,7 +157,7 @@ function readDate(value) {
|
|
|
157
157
|
function entryToItem(entry, feed, siteUrl, trailingSlash) {
|
|
158
158
|
const data = entry.data ?? {};
|
|
159
159
|
const meta = entry._meta ?? {};
|
|
160
|
-
const url = entryUrl(siteUrl, feed.basePath, entry.id, trailingSlash);
|
|
160
|
+
const url = typeof meta.url === "string" && meta.url.startsWith("/") ? new URL(meta.url, siteUrl).href : entryUrl(siteUrl, feed.basePath, entry.id, trailingSlash);
|
|
161
161
|
const published = readDate(data[feed.dateField]) ?? readDate(meta.mtime);
|
|
162
162
|
const { author } = data;
|
|
163
163
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/feed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Syndication feeds for Jx: Atom (RFC 4287) and JSON Feed emitted from content collections at build time",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"upgrade": "bun update --latest && bun install"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@jxsuite/schema": "^
|
|
38
|
+
"@jxsuite/schema": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"ajv": "^8.20.0"
|
package/src/Feed.class.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"$prototype": "Class",
|
|
4
4
|
"title": "Feed",
|
|
5
5
|
"description": "Atom (RFC 4287) and JSON Feed generation from content collections, with RFC 5005 archives",
|
|
6
|
-
"$implementation": "./feed.
|
|
6
|
+
"$implementation": "./feed.js",
|
|
7
7
|
"project": {
|
|
8
8
|
"key": "feed",
|
|
9
9
|
"title": "Feeds",
|
package/src/shared.ts
CHANGED
|
@@ -122,7 +122,15 @@ export function entryToItem(
|
|
|
122
122
|
): FeedItem {
|
|
123
123
|
const data = (entry.data ?? {}) as Record<string, unknown>;
|
|
124
124
|
const meta = (entry._meta ?? {}) as Record<string, unknown>;
|
|
125
|
-
|
|
125
|
+
/*
|
|
126
|
+
* An entry of a content type with a `route` already knows its URL: the loader stamped it at
|
|
127
|
+
* `_meta.url`, from the same template the pages and the links were generated from. Only an entry
|
|
128
|
+
* with no route is placed by the feed's own `basePath` + id, which is the older, flat rule.
|
|
129
|
+
*/
|
|
130
|
+
const url =
|
|
131
|
+
typeof meta.url === "string" && meta.url.startsWith("/")
|
|
132
|
+
? new URL(meta.url, siteUrl).href
|
|
133
|
+
: entryUrl(siteUrl, feed.basePath, entry.id, trailingSlash);
|
|
126
134
|
const published = readDate(data[feed.dateField]) ?? readDate(meta.mtime);
|
|
127
135
|
const { author } = data;
|
|
128
136
|
|