1 ? 'flex-col' : 'flex-row-reverse')}>
-
{name}
{
alt={name} />
+ {hasName(image) &&
{name}
}
{getMeta(image).iptc.caption}
some other meta
@@ -67,7 +67,7 @@ export const query = graphql`
layout: CONSTRAINED
# placeholder: BLURRED
# placeholder: DOMINANT_COLOR
- # placeholder: TRACED_SVG
+ placeholder: TRACED_SVG
height: 2048
)
fields {
diff --git a/gatsby/src/utils.js b/gatsby/src/utils.js
index 103676c..9a9cae9 100644
--- a/gatsby/src/utils.js
+++ b/gatsby/src/utils.js
@@ -1,3 +1,5 @@
export const getMeta = (image) => image.childImageSharp.fields.imageMeta
-export const getName = (image) => getMeta(image)?.iptc.object_name || image.base
\ No newline at end of file
+export const getName = (image) => getMeta(image)?.iptc.object_name || image.base
+
+export const hasName = (image) => Boolean(getMeta(image)?.iptc.object_name)
\ No newline at end of file