diff --git a/src/meta/__tests__/buildTags.test.jsx b/src/meta/__tests__/buildTags.test.jsx index 0d9c214c..98207db7 100644 --- a/src/meta/__tests__/buildTags.test.jsx +++ b/src/meta/__tests__/buildTags.test.jsx @@ -141,3 +141,18 @@ it('correctly sets noindex, nofollow', () => { expect(Array.from(index).length).toBe(0); expect(Array.from(noindex).length).toBe(2); }); + +it('displays title with titleTemplate integrated', () => { + const template = 'Next SEO'; + const overrideProps = { + ...SEO, + titleTemplate: `${template} | %s`, + }; + const tags = buildTags(overrideProps); + const { container } = render(tags); + const title = getByText( + container, + (content, element) => element.tagName.toLowerCase() === 'title' && content.startsWith(template), + ); + expect(title.innerHTML).toMatch(`${template} | ${SEO.title}`); +}); diff --git a/src/meta/buildTags.jsx b/src/meta/buildTags.jsx index 4936d240..c3c3a1a7 100644 --- a/src/meta/buildTags.jsx +++ b/src/meta/buildTags.jsx @@ -4,7 +4,11 @@ const buildTags = (config) => { const tagsToRender = []; if (config.title) { - tagsToRender.push(