diff --git a/apps/website/src/templates/home.tsx b/apps/website/src/templates/home.tsx index 8c149c00a..9b8ac0e25 100644 --- a/apps/website/src/templates/home.tsx +++ b/apps/website/src/templates/home.tsx @@ -28,6 +28,9 @@ export function Head({ data }: HeadProps) { key={`link-${index}`} rel={metaTag.attributes?.rel} href={metaTag.attributes?.href} + type={ + metaTag.attributes?.rel === 'image_src' ? 'image' : undefined + } /> ); } diff --git a/apps/website/src/templates/page.tsx b/apps/website/src/templates/page.tsx index 63510fcdb..4ebb17a08 100644 --- a/apps/website/src/templates/page.tsx +++ b/apps/website/src/templates/page.tsx @@ -30,6 +30,9 @@ export function Head({ data }: HeadProps) { key={`link-${index}`} rel={metaTag.attributes?.rel} href={metaTag.attributes?.href} + type={ + metaTag.attributes?.rel === 'image_src' ? 'image' : undefined + } /> ); } diff --git a/tests/schema/specs/content.spec.ts b/tests/schema/specs/content.spec.ts index a23618aef..0915922dd 100644 --- a/tests/schema/specs/content.spec.ts +++ b/tests/schema/specs/content.spec.ts @@ -33,6 +33,20 @@ test('Page', async () => { complete: _loadDrupalPage(id: "ef80e284-154b-41fd-9317-154b0a175299") { ...Page } + seo_all_empty: _loadDrupalPage( + id: "5f108e07-62ca-4025-adca-069b3adfc22c" + ) { + translations { + ...Page + } + } + seo_all_filled_in: _loadDrupalPage( + id: "6344bdc5-1b02-4542-b4ae-4e6df23b3e4c" + ) { + translations { + ...Page + } + } } `); expect(result).toMatchInlineSnapshot(` @@ -79,6 +93,198 @@ test('Page', async () => { }, "title": "Page: complete", }, + "seo_all_empty": { + "translations": [ + { + "content": [ + { + "__typename": "BlockMarkup", + }, + ], + "hero": { + "__typename": "Hero", + }, + "locale": "en", + "metaTags": [ + { + "attributes": { + "content": "SEO test - all empty | Silverback Drupal Template", + "href": null, + "name": "title", + "property": null, + "rel": null, + }, + "tag": "meta", + }, + { + "attributes": { + "content": null, + "href": "http://127.0.0.1:8000/en/seo-test-all-empty", + "name": null, + "property": null, + "rel": "canonical", + }, + "tag": "link", + }, + ], + "path": "/en/seo-test-all-empty", + "teaserImage": null, + "title": "SEO test - all empty", + }, + { + "content": [ + { + "__typename": "BlockMarkup", + }, + ], + "hero": { + "__typename": "Hero", + }, + "locale": "de", + "metaTags": [ + { + "attributes": { + "content": "SEO test - all empty DE | Silverback Drupal Template", + "href": null, + "name": "title", + "property": null, + "rel": null, + }, + "tag": "meta", + }, + { + "attributes": { + "content": null, + "href": "http://127.0.0.1:8000/de/seo-test-all-empty-de", + "name": null, + "property": null, + "rel": "canonical", + }, + "tag": "link", + }, + ], + "path": "/de/seo-test-all-empty-de", + "teaserImage": null, + "title": "SEO test - all empty DE", + }, + ], + }, + "seo_all_filled_in": { + "translations": [ + { + "content": [ + { + "__typename": "BlockMarkup", + }, + ], + "hero": { + "__typename": "Hero", + }, + "locale": "en", + "metaTags": [ + { + "attributes": { + "content": "Overwritten SEO title | Silverback Drupal Template", + "href": null, + "name": "title", + "property": null, + "rel": null, + }, + "tag": "meta", + }, + { + "attributes": { + "content": "SEO description", + "href": null, + "name": "description", + "property": null, + "rel": null, + }, + "tag": "meta", + }, + { + "attributes": { + "content": null, + "href": "http://127.0.0.1:8000/en/seo-test-all-filled", + "name": null, + "property": null, + "rel": "canonical", + }, + "tag": "link", + }, + { + "attributes": { + "content": null, + "href": "/sites/default/files/2024-04/the_silverback.jpeg", + "name": null, + "property": null, + "rel": "image_src", + }, + "tag": "link", + }, + ], + "path": "/en/seo-test-all-filled", + "teaserImage": null, + "title": "SEO test - all filled in", + }, + { + "content": [ + { + "__typename": "BlockMarkup", + }, + ], + "hero": { + "__typename": "Hero", + }, + "locale": "de", + "metaTags": [ + { + "attributes": { + "content": "Overwritten SEO title DE | Silverback Drupal Template", + "href": null, + "name": "title", + "property": null, + "rel": null, + }, + "tag": "meta", + }, + { + "attributes": { + "content": "SEO description DE", + "href": null, + "name": "description", + "property": null, + "rel": null, + }, + "tag": "meta", + }, + { + "attributes": { + "content": null, + "href": "http://127.0.0.1:8000/de/seo-test-all-filled-de", + "name": null, + "property": null, + "rel": "canonical", + }, + "tag": "link", + }, + { + "attributes": { + "content": null, + "href": "/sites/default/files/2024-04/the_silverback.jpeg", + "name": null, + "property": null, + "rel": "image_src", + }, + "tag": "link", + }, + ], + "path": "/de/seo-test-all-filled-de", + "teaserImage": null, + "title": "SEO test - all filled in DE", + }, + ], + }, }, } `);