astro-accelerator 0.0.48 → 0.0.50
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 +1 -1
- package/public/css/main.css +20 -3
- package/public/js/main.js +3 -1
- package/public/js/modules/share.js +24 -0
- package/src/config.ts +0 -3
- package/src/pages/sitemap.xml.ts +7 -1
- package/src/themes/accelerator/components/Authors.astro +4 -1
- package/src/themes/accelerator/components/Related.astro +2 -0
package/package.json
CHANGED
package/public/css/main.css
CHANGED
|
@@ -959,6 +959,19 @@ figure:focus .magnify-icon {
|
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
|
|
962
|
+
button[data-share] {
|
|
963
|
+
background-color: unset;
|
|
964
|
+
cursor: pointer;
|
|
965
|
+
color: var(--fore-link);
|
|
966
|
+
stroke: var(--fore-link);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
button[data-share]:hover,
|
|
970
|
+
button[data-share]:focus {
|
|
971
|
+
color: var(--fore-link-alt);
|
|
972
|
+
stroke: var(--fore-link-alt);
|
|
973
|
+
}
|
|
974
|
+
|
|
962
975
|
/* Animation */
|
|
963
976
|
|
|
964
977
|
@media (prefers-reduced-motion: no-preference) {
|
|
@@ -972,10 +985,14 @@ figure:focus .magnify-icon {
|
|
|
972
985
|
|
|
973
986
|
.magnify-icon,
|
|
974
987
|
.copy-button,
|
|
975
|
-
.anim-show-parent
|
|
988
|
+
.anim-show-parent .list-item,
|
|
976
989
|
.anim-show-parent img {
|
|
977
|
-
transition: all 0.
|
|
990
|
+
transition: all 0.2s ease-in;
|
|
978
991
|
transition-delay: 0.1s;
|
|
979
|
-
|
|
992
|
+
scale: calc(0.75 + (var(--shown, 1) * 0.25));
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
.anim-show-parent .list-item img {
|
|
996
|
+
scale: 1;
|
|
980
997
|
}
|
|
981
998
|
}
|
package/public/js/main.js
CHANGED
|
@@ -6,6 +6,7 @@ import { addMobileNav } from './modules/nav-mobile.js';
|
|
|
6
6
|
import { setClickableBlocks } from './modules/click-blocks.js';
|
|
7
7
|
import { setExternalLinkAttributes } from './modules/external-links.js';
|
|
8
8
|
import { monitorInputType } from './modules/input-type.js';
|
|
9
|
+
import { enableSharing } from './modules/share.js';
|
|
9
10
|
|
|
10
11
|
const resizedEventName = addResizedEvent();
|
|
11
12
|
|
|
@@ -13,9 +14,10 @@ setClickableBlocks();
|
|
|
13
14
|
setExternalLinkAttributes();
|
|
14
15
|
addStickyNavigation('.site-header', '#site-nav', '#site-nav > ul', resizedEventName);
|
|
15
16
|
addMobileNav(resizedEventName);
|
|
16
|
-
addIntersectionObserver('.anim-show-parent img, .anim-show-parent
|
|
17
|
+
addIntersectionObserver('.anim-show-parent img, .anim-show-parent .list-item');
|
|
17
18
|
addListImageIntersectionObserver('.post-list img');
|
|
18
19
|
monitorInputType();
|
|
20
|
+
enableSharing();
|
|
19
21
|
|
|
20
22
|
// @ts-ignore
|
|
21
23
|
const f = site_features ?? {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { qs, qsa } from './query.js';
|
|
2
|
+
|
|
3
|
+
function handleClick() {
|
|
4
|
+
|
|
5
|
+
const title = this.dataset.sharetitle ?? qs('meta[property="og:title"]').content;
|
|
6
|
+
const text = this.dataset.sharetext ?? qs('meta[property="og:description"]').content;
|
|
7
|
+
const url = this.dataset.shareurl ?? document.location;
|
|
8
|
+
|
|
9
|
+
const share = {
|
|
10
|
+
title: title,
|
|
11
|
+
text: text,
|
|
12
|
+
url: url
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
navigator.share(share);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function enableSharing() {
|
|
19
|
+
qsa('[data-share]').forEach((elem) => {
|
|
20
|
+
elem.addEventListener('click', handleClick);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { enableSharing }
|
package/src/config.ts
CHANGED
package/src/pages/sitemap.xml.ts
CHANGED
|
@@ -15,10 +15,16 @@ async function getData() {
|
|
|
15
15
|
const article: any = await allPages[path]();
|
|
16
16
|
const addToSitemap = PostFiltering.showInSitemap(article);
|
|
17
17
|
|
|
18
|
+
let url = accelerator.urlFormatter.addSlashToAddress(article.url);
|
|
19
|
+
|
|
20
|
+
if (article.frontmatter.layout == 'src/layouts/Author.astro') {
|
|
21
|
+
url += '1/';
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
if (addToSitemap) {
|
|
19
25
|
pages.push(`
|
|
20
26
|
<url>
|
|
21
|
-
<loc>${ SITE.url +
|
|
27
|
+
<loc>${ SITE.url + url }</loc>
|
|
22
28
|
<lastmod>${ article.frontmatter.pubDate }</lastmod>
|
|
23
29
|
</url>`);
|
|
24
30
|
}
|
|
@@ -33,7 +33,10 @@ const authorImage = authorList?.image?.src
|
|
|
33
33
|
sizes={ authorImage.sizes }
|
|
34
34
|
src={ authorImage.src }
|
|
35
35
|
alt={ authorList?.image?.alt }
|
|
36
|
-
class={ authorImage.class }
|
|
36
|
+
class={ authorImage.class }
|
|
37
|
+
width={ authorImage.metadata?.width }
|
|
38
|
+
height={ authorImage.metadata?.height }
|
|
39
|
+
/>
|
|
37
40
|
}
|
|
38
41
|
<div class="author-info">
|
|
39
42
|
<span class="author-list">{ _(Translations.post.written_by) }
|