Skip to content

Commit c5f0b14

Browse files
committed
Add download name to svg.
1 parent 6039156 commit c5f0b14

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/pages/media/card/[slug].astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ fitAllText();
8484
window.addEventListener('resize', fitAllText);
8585
</script>
8686

87-
88-
<script>
87+
<script define:vars={{slug: entry.data.slug}}>
8988
document.addEventListener('DOMContentLoaded', () => {
9089
document.querySelectorAll('.social').forEach((socialDiv, index) => {
9190

@@ -118,7 +117,7 @@ window.addEventListener('resize', fitAllText);
118117

119118
const a = document.createElement('a');
120119
a.href = url;
121-
a.download = `social_media.svg`;
120+
a.download = slug ? `social-${slug}.svg` : `social-${index +1}.svg`;
122121
a.style.display = "none";
123122
document.body.appendChild(a);
124123
a.click();

0 commit comments

Comments
 (0)