astro-accelerator 4.0.32 → 4.0.35
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 +1 -1
- package/package.json +4 -4
- package/src/env.d.ts +4 -0
- package/src/pages/authors/[author]/[page].astro +34 -6
- package/.npmrc +0 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ pnpm install --force @img/sharp-linux-x64
|
|
|
31
31
|
|
|
32
32
|
## Publish to NPM
|
|
33
33
|
|
|
34
|
-
Update the `package.json` with the new version number, and commit the change
|
|
34
|
+
Update the `package.json` with the new version number, and commit the change.
|
|
35
35
|
|
|
36
36
|
The NPM token expires periodically and must be updated in GitHub settings -> Secrets -> Actions.
|
|
37
37
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.
|
|
2
|
+
"version": "4.0.35",
|
|
3
3
|
"author": "Steve Fenton",
|
|
4
4
|
"name": "astro-accelerator",
|
|
5
5
|
"description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@astrojs/mdx": "^2.3.1",
|
|
35
35
|
"astro": "^4.11.5",
|
|
36
|
-
"astro-accelerator-utils": "^0.3.
|
|
37
|
-
"cspell": "^8.
|
|
36
|
+
"astro-accelerator-utils": "^0.3.9",
|
|
37
|
+
"cspell": "^8.11.0",
|
|
38
38
|
"csv": "^6.3.9",
|
|
39
39
|
"hast-util-from-selector": "^3.0.0",
|
|
40
40
|
"html-to-text": "^9.0.5",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"sharp": "^0.33.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@playwright/test": "^1.45.
|
|
47
|
+
"@playwright/test": "^1.45.2"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
".npmrc",
|
package/src/env.d.ts
ADDED
|
@@ -11,6 +11,7 @@ import { SITE } from '@config';
|
|
|
11
11
|
import Default from 'src/layouts/Default.astro';
|
|
12
12
|
import ArticleList from '@components/ArticleList.astro';
|
|
13
13
|
import PagingLinks from '@components/PagingLinks.astro';
|
|
14
|
+
import { getImageInfo } from '@util/custom-markdown.mjs';
|
|
14
15
|
|
|
15
16
|
const accelerator = new Accelerator(SITE);
|
|
16
17
|
const stats = new accelerator.statistics('pages/authors/[author]/[page].astro');
|
|
@@ -66,11 +67,11 @@ export async function getData() {
|
|
|
66
67
|
.sort(PostOrdering.sortByPubDateDesc);
|
|
67
68
|
|
|
68
69
|
data.posts.forEach(p => {
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
70
|
+
const authorList: string[] = p.frontmatter.authors ?? [];
|
|
71
|
+
if (authorList.length == 0) {
|
|
71
72
|
console.log('No authors found', p.url);
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
+
authorList.forEach(a => {
|
|
74
75
|
if (!data.authors.includes(a)) {
|
|
75
76
|
data.authors.push(a);
|
|
76
77
|
}
|
|
@@ -85,8 +86,8 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
85
86
|
|
|
86
87
|
return data.authors.map(a => {
|
|
87
88
|
const filtered = data.posts.filter(p => {
|
|
88
|
-
const
|
|
89
|
-
return
|
|
89
|
+
const authorList: string[] = p.frontmatter.authors ?? [];
|
|
90
|
+
return authorList.includes(a);
|
|
90
91
|
});
|
|
91
92
|
return paginate(filtered, {
|
|
92
93
|
params: { author: a.toLowerCase() },
|
|
@@ -96,6 +97,11 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
96
97
|
}).flat();
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
// Get image info
|
|
101
|
+
const authorImage = author.frontmatter.bannerImage?.src
|
|
102
|
+
? getImageInfo(author.frontmatter.bannerImage.src, 'author-image', SITE.images.authorSize)
|
|
103
|
+
: null;
|
|
104
|
+
|
|
99
105
|
// Page Links
|
|
100
106
|
const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
101
107
|
|
|
@@ -113,7 +119,29 @@ if (page.url.current != pageLinks[0].url) {
|
|
|
113
119
|
stats.stop();
|
|
114
120
|
---
|
|
115
121
|
<Default frontmatter={ authorFrontmatter } headings={ headings } breadcrumbs={ breadcrumbs }>
|
|
116
|
-
<
|
|
122
|
+
<div class="author-page">
|
|
123
|
+
{authorImage &&
|
|
124
|
+
<img
|
|
125
|
+
srcset={ authorImage.srcset }
|
|
126
|
+
sizes={ authorImage.sizes }
|
|
127
|
+
src={ authorImage.src }
|
|
128
|
+
alt={ author.frontmatter.bannerImage?.alt }
|
|
129
|
+
class={ authorImage.class }
|
|
130
|
+
width={ authorImage.metadata?.width }
|
|
131
|
+
height={ authorImage.metadata?.height }
|
|
132
|
+
/>
|
|
133
|
+
}
|
|
134
|
+
<div class="author-info">
|
|
135
|
+
<Fragment set:html={ authorText } />
|
|
136
|
+
{author.frontmatter.links &&
|
|
137
|
+
<ul>
|
|
138
|
+
{author.frontmatter.links.map((link) => (
|
|
139
|
+
<li><a href={ link.url } rel={ link.rel }><Fragment set:html={ link.text } /></a></li>
|
|
140
|
+
))}
|
|
141
|
+
</ul>
|
|
142
|
+
}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
117
145
|
<h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString()) }</h2>
|
|
118
146
|
<ArticleList lang={ lang } posts={ page.data } />
|
|
119
147
|
<PagingLinks lang={ lang } page={ page } pageLinks={ pageLinks } />
|
package/.npmrc
DELETED