Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Commit d7d8d02

Browse files
Merge pull request #7 from kasperlegarth/Fallback-for-posts-with-no-captions
Added check to see if there is a caption to show
2 parents 4a71037 + 079026f commit d7d8d02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

instastory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
let templateCodes = {
8484
"{{accessibility_caption}}" : post.accessibility_caption,
85-
"{{caption}}": post.edge_media_to_caption.edges[0].node.text,
85+
"{{caption}}": ((post.edge_media_to_caption.edges.length > 0) ? post.edge_media_to_caption.edges[0].node.text : ""),
8686
"{{comments}}": post.edge_media_to_comment.count,
8787
"{{image}}": getImageSize(post),
8888
"{{likes}}": post.edge_liked_by.count,

0 commit comments

Comments
 (0)