astro-accelerator 7.1.25 → 7.1.27

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.1.25",
2
+ "version": "7.1.27",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -8,7 +8,7 @@
8
8
  "themes"
9
9
  ],
10
10
  "type": "module",
11
- "packageManager": "pnpm@10.22.0",
11
+ "packageManager": "pnpm@12.6.0",
12
12
  "engines": {
13
13
  "node": ">=24",
14
14
  "pnpm": ">=10"
@@ -40,7 +40,7 @@
40
40
  "@astrojs/mdx": "^8.0.1",
41
41
  "@img/sharp-linux-x64": "^0.35.4",
42
42
  "astro": "^7.3.3",
43
- "astro-accelerator-utils": "^0.3.110",
43
+ "astro-accelerator-utils": "^0.3.111",
44
44
  "csv": "^6.6.3",
45
45
  "hast-util-from-selector": "^3.0.1",
46
46
  "html-to-text": "^10.0.1",
@@ -22,6 +22,18 @@ function escapeXml(text: string): string {
22
22
  .replace(/'/g, ''');
23
23
  }
24
24
 
25
+ function getAbsoluteImageUrl(src: unknown): string | undefined {
26
+ if (typeof src !== 'string' || src.length === 0) {
27
+ return undefined;
28
+ }
29
+
30
+ try {
31
+ return new URL(src, SITE.url).href;
32
+ } catch {
33
+ return undefined;
34
+ }
35
+ }
36
+
25
37
  async function getData() {
26
38
  //@ts-ignore
27
39
  const allArticles = import.meta.glob(['./**/*.md', './**/*.mdx']);
@@ -82,7 +94,9 @@ async function getData() {
82
94
  .sort(PostOrdering.sortByModDateDesc)
83
95
  .slice(0, limit)
84
96
  .map(
85
- (a) => `
97
+ (a) => {
98
+ const imageUrl = getAbsoluteImageUrl(a.frontmatter.bannerImage?.src);
99
+ return `
86
100
  <entry>
87
101
  <title>${escapeXml(a.frontmatter.title ?? '')}</title>
88
102
  <link href="${SITE.url + a.url}" />
@@ -90,11 +104,13 @@ async function getData() {
90
104
  <published>${a.frontmatter.pubDate}</published>
91
105
  <updated>${a.frontmatter.modDate ?? a.frontmatter.pubDate}</updated>
92
106
  <summary>${escapeXml(a.frontmatter.description ?? '')}</summary>
107
+ ${imageUrl ? `<link rel="enclosure" href="${escapeXml(imageUrl)}" type="image/*" />` : ''}
93
108
  <author>
94
109
  <name>${escapeXml(getAuthorName(a.frontmatter))}</name>
95
110
  </author>
96
- <content type="html"><![CDATA[${contentItems[a.url] ?? ''}]]></content>
97
- </entry>`
111
+ <content type="html"><![CDATA[${(a.url && contentItems[a.url]) ?? ''}]]></content>
112
+ </entry>`;
113
+ }
98
114
  );
99
115
 
100
116
  stats.stop();
File without changes
File without changes
File without changes
File without changes