astro-accelerator 0.0.60 → 0.0.62
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
package/src/config.ts
CHANGED
|
@@ -36,8 +36,9 @@ const SITE: Site = {
|
|
|
36
36
|
youTubeLinks: ['embed'],
|
|
37
37
|
},
|
|
38
38
|
images: {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// Generated using https://ausi.github.io/respimagelint/
|
|
40
|
+
contentSize: '(min-width: 1280px) 668px, (min-width: 880px) calc(72.11vw - 241px), calc(100vw - 64px)',
|
|
41
|
+
listerSize: '(min-width: 1300px) 350px, (min-width: 880px) calc(34.25vw - 88px), (min-width: 700px) 50vw, calc(100vw - 32px)',
|
|
41
42
|
authorSize: '50px',
|
|
42
43
|
}
|
|
43
44
|
};
|
|
@@ -89,17 +89,28 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
89
89
|
const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
90
90
|
|
|
91
91
|
// Breadcrumbs
|
|
92
|
-
const breadcrumbs = [
|
|
93
|
-
|
|
92
|
+
const breadcrumbs: { url: string; title: string; ariaCurrent?: string; }[] = []
|
|
93
|
+
|
|
94
|
+
if (page.url.current == pageLinks[0].url) {
|
|
95
|
+
breadcrumbs.push({
|
|
96
|
+
url: pageLinks[0].url as string,
|
|
97
|
+
title: title,
|
|
98
|
+
ariaCurrent: 'page'
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (page.url.current != pageLinks[0].url) {
|
|
103
|
+
breadcrumbs.push({
|
|
94
104
|
url: pageLinks[0].url as string,
|
|
95
105
|
title: title,
|
|
96
|
-
}
|
|
97
|
-
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
breadcrumbs.push({
|
|
98
109
|
url: page.url.current,
|
|
99
110
|
title: _(Translations.articles.page_title).replace('{n}', page.currentPage.toString()),
|
|
100
111
|
ariaCurrent: 'page',
|
|
101
|
-
}
|
|
102
|
-
|
|
112
|
+
});
|
|
113
|
+
}
|
|
103
114
|
---
|
|
104
115
|
<Default frontmatter={ frontmatter } headings={ headings } breadcrumbs={ breadcrumbs }>
|
|
105
116
|
<h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString()) }</h2>
|
|
@@ -88,17 +88,28 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
88
88
|
const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
89
89
|
|
|
90
90
|
// Breadcrumbs
|
|
91
|
-
const breadcrumbs = [
|
|
92
|
-
|
|
91
|
+
const breadcrumbs: { url: string; title: string; ariaCurrent?: string; }[] = []
|
|
92
|
+
|
|
93
|
+
if (page.url.current == pageLinks[0].url) {
|
|
94
|
+
breadcrumbs.push({
|
|
95
|
+
url: pageLinks[0].url as string,
|
|
96
|
+
title: title,
|
|
97
|
+
ariaCurrent: 'page'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (page.url.current != pageLinks[0].url) {
|
|
102
|
+
breadcrumbs.push({
|
|
93
103
|
url: pageLinks[0].url as string,
|
|
94
104
|
title: title,
|
|
95
|
-
}
|
|
96
|
-
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
breadcrumbs.push({
|
|
97
108
|
url: page.url.current,
|
|
98
109
|
title: _(Translations.articles.page_title).replace('{n}', page.currentPage.toString()),
|
|
99
110
|
ariaCurrent: 'page',
|
|
100
|
-
}
|
|
101
|
-
|
|
111
|
+
});
|
|
112
|
+
}
|
|
102
113
|
---
|
|
103
114
|
<Default frontmatter={ frontmatter } headings={ headings } breadcrumbs={ breadcrumbs }>
|
|
104
115
|
<h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString())}</h2>
|
|
@@ -51,27 +51,41 @@ export function getImageInfo(src, className, sizes) {
|
|
|
51
51
|
const imgMedium = getDestination(uri, size.medium);
|
|
52
52
|
const imgLarge = getDestination(uri, size.large);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
info.srcset = `${imgSmall} ${size.small}w, ${imgMedium} ${size.medium}w, ${imgLarge}`;
|
|
56
|
-
info.sizes = sizes;
|
|
57
|
-
info.class = (className ?? '' + ' resp-img').trim();
|
|
54
|
+
let nativeSize = size.large;
|
|
58
55
|
info.metadata = null;
|
|
59
56
|
|
|
60
|
-
if ([imgSmall, imgMedium, imgLarge].includes(src)) {
|
|
61
|
-
info.srcset = null;
|
|
62
|
-
info.sizes = null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
57
|
try {
|
|
66
58
|
let metaAddress = path.join(workingDirectory, 'public', src + '.json');
|
|
67
|
-
|
|
59
|
+
|
|
68
60
|
if (fs.existsSync(metaAddress)) {
|
|
69
61
|
info.metadata = JSON.parse(fs.readFileSync(metaAddress));
|
|
62
|
+
nativeSize = info.metadata.width;
|
|
70
63
|
}
|
|
71
64
|
} catch (e) {
|
|
72
65
|
console.warn(e);
|
|
73
66
|
}
|
|
74
67
|
|
|
68
|
+
info.src = imgFallback;
|
|
69
|
+
// use info.metadata to limit the {}w size to the image size if it's smaller
|
|
70
|
+
let srcset = `${imgSmall} ${Math.min(size.small, nativeSize)}w`;
|
|
71
|
+
|
|
72
|
+
if (nativeSize >= size.small) {
|
|
73
|
+
srcset += `, ${imgMedium} ${Math.min(size.medium, nativeSize)}w`;
|
|
74
|
+
|
|
75
|
+
if (nativeSize >= size.medium) {
|
|
76
|
+
srcset += `, ${imgLarge} ${Math.min(size.large, nativeSize)}w`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
info.srcset = srcset;
|
|
81
|
+
info.sizes = sizes;
|
|
82
|
+
info.class = (className ?? '' + ' resp-img').trim();
|
|
83
|
+
|
|
84
|
+
if ([imgSmall, imgMedium, imgLarge].includes(src)) {
|
|
85
|
+
info.srcset = null;
|
|
86
|
+
info.sizes = null;
|
|
87
|
+
}
|
|
88
|
+
|
|
75
89
|
return info;
|
|
76
90
|
}
|
|
77
91
|
|