diff --git a/components/x-live-blog-post/src/LiveBlogPost.jsx b/components/x-live-blog-post/src/LiveBlogPost.jsx index 73b402136..6eb960f77 100644 --- a/components/x-live-blog-post/src/LiveBlogPost.jsx +++ b/components/x-live-blog-post/src/LiveBlogPost.jsx @@ -70,7 +70,7 @@ const LiveBlogPost = ({ /> ) } - if (typeof byline === 'object' && 'tree' in byline) { + if (byline && typeof byline === 'object' && 'tree' in byline) { postByline = (

diff --git a/components/x-live-blog-post/src/__tests__/LiveBlogPost.test.jsx b/components/x-live-blog-post/src/__tests__/LiveBlogPost.test.jsx index a37066eca..40700f084 100644 --- a/components/x-live-blog-post/src/__tests__/LiveBlogPost.test.jsx +++ b/components/x-live-blog-post/src/__tests__/LiveBlogPost.test.jsx @@ -252,6 +252,13 @@ describe('x-live-blog-post', () => { expect(liveBlogPost.html()).toContain('class="x-live-blog-post__body') expect(liveBlogPost.html()).toContain('

structured live blog body

') }) + + it('handles posts without bylines', () => { + const postWithoutByline = { ...regularPostContentPipeline, byline: null } + const liveBlogPost = mount() + expect(liveBlogPost.html()).toContain('class="x-live-blog-post__body') + expect(liveBlogPost.html()).toContain('

structured live blog body

') + }) }) it('adds a data-x-component attribute', () => {